Skip to content

Conversation

@noob9527
Copy link
Contributor

@noob9527 noob9527 commented Jan 9, 2024

the lib use require and module.paths API to resolve the package.json file. these API call cannot be transformed into equivalent API call in es module, which make it incompatible with some build systems(vite). it throw the following exception

Uncaught Exception:
TypeError: module2.paths is not iterable at detectPackageJson

it's because loadPackageJson fail.

Could not dynamically require ".../package.json". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.

Unfortunately, somehow configure dynamicRequireTargets as the error hint doesn't solve the problem, maybe it's because the pre-bundle mechanism in vite.
I think allow the user to pass in package.json directly is the quickest way to solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant