wollardj / simple-plist

A simple API for interacting with binary and plain text plist data.
MIT License
57 stars 22 forks source link

Cannot find module 'bplist-creator' #58

Open larryhuang opened 3 years ago

larryhuang commented 3 years ago

Environment:

Scenario

Error

rajmonotype commented 2 years ago

Its still giving issue with node v14.18.0 and simple-plist version 1.3.0 not with 1.1.0

wollardj commented 2 years ago

I haven't seen this issue myself and I can't seem to reproduce it locally with node v16.13.0 on macOS. @rajmonotype are you also on Windows by chance?

dnicolson commented 2 years ago

I think the issue might relate to using ESM imports, I can reproduce the problem if I use import instead of require.

realtril commented 2 years ago

@larryhuang have you find a way to fix the issue?

realtril commented 2 years ago

@rajmonotype have you find a way to fix the issue?

dnicolson commented 2 years ago

The issue I'm experiencing appears to relate to changes in version 1.3.1 where a default export is incompatible with version 1.3.0 for ESM imports but still may be relevant to this issue.

CommonJS imports work with 1.3.1 but ESM imports have issues with missing types in bplist-creator and bplist-parser and there is no default export in bplist-parser.

realtril commented 2 years ago

The issue I'm experiencing appears to relate to changes in version 1.3.1 where a default export is incompatible with version 1.3.0 for ESM imports but still may be relevant to this issue.

CommonJS imports work with 1.3.1 but ESM imports have issues with missing types in bplist-creator and bplist-parser and there is no default export in bplist-parser.

@dnicolson how did you solve an issue?

dnicolson commented 2 years ago

@realtril I don't have a solution, have you tried using CommonJS imports? For example:

const plist = require("simple-plist");
realtril commented 2 years ago

dnicolson

yeah, simple-plist is a subdependency. so all over the places it is being used by CommonJS imports.

wollardj commented 2 years ago

Hey @larryhuang et al. I've just released v1.4.0 over on npm under the next tag. I realize this issue is old, but if anyone listed here is still struggling with the issue, please give 1.4.0 a shot and let me know if it does the trick.

walkingbrad commented 1 year ago

I had this issue on the latest stable 1.3.1. Upgrading to 1.4.0 changes which module this breaks on:

import plist from "simple-plist"

yarn run v1.22.19
$ npx ttsc
node_modules/simple-plist/dist/parse.d.ts:3:33 - error TS7016: Could not find a declaration file for module 'plist'. '/Users/myusername/path/to/my/repo/node_modules/plist/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/plist` if it exists or add a new declaration (.d.ts) file containing `declare module 'plist';`

3 import type { PlistValue } from "plist";
                                  ~~~~~~~

Found 1 error in node_modules/simple-plist/dist/parse.d.ts:3

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment:

dnicolson commented 1 year ago

@walkingbrad there are no default exports, according to the documentation you need to import named exports:

import * as plist from "simple-plist";

With version 1.4.0 I see different errors outlined in https://github.com/wollardj/simple-plist/pull/68#issuecomment-1666886401.

davfive commented 1 year ago

Hey @larryhuang et al. I've just released v1.4.0 over on npm under the next tag. I realize this issue is old, but if anyone listed here is still struggling with the issue, please give 1.4.0 a shot and let me know if it does the trick.

I've just tried 1.4.0-0 and it fixes my issue, compiling fine now. Is there an ETA for when 1.4.0 will be fully released or if the type issues can be fixed in the 1.3 branch?

What I was seeing: with import plist from 'simple-plist'

My errors: image

image

I also got errors with bplistCreator when I was noodling around trying to get around it.

Here's the full set of errors shown in vscode Problems when I look at the file image

walkingbrad commented 1 year ago

"simple-plist": "next" does fix the compiler errors 🙏