You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, it is not listed as a dependency in package.json. When a project depends on chalk v5+ (which is pure ESM), import of chalk fails. It is attempted to be imported as CommonJS from dist/command.js, but only ESM is available. This causes Node.js to crash with ERR_REQUIRE_ESM.
Expected Behavior
A specific major version of chalk is mentioned in package.json, so the right copy of this dependency is resolved when webextension-toolbox is called. If it’s v5 (ESM), a built version command.ts is using an async import or is using ESM itself.
Current Behavior
A ‘random’ version of chalk is picked, depending of the downstream project’s dependency tree. If that is v4 or less, then everything works. If that is v5.0.0 or greater, the tool crashes.
Steps to Reproduce (for bugs)
Happy to provide these a bit later if needed
Context
Trying to run webextension-toolbox build
Your Environment
Tech
Version
webextension-toolbox
6.2.0
node
18.8.2
OS
macos
The text was updated successfully, but these errors were encountered:
kachkaev
changed the title
Chalk is an implicit dependency
Chalk is an implicit dependency (should be explicit)
Dec 4, 2023
👋 folks! Great library! 💯 I’ve noticed one edge case and have decided to share it.
Chalk is used in
command.ts
:webextension-toolbox/src/command.ts
Line 2 in 1b6482f
However, it is not listed as a dependency in
package.json
. When a project depends on chalk v5+ (which is pure ESM), import of chalk fails. It is attempted to be imported as CommonJS fromdist/command.js
, but only ESM is available. This causes Node.js to crash withERR_REQUIRE_ESM
.Expected Behavior
A specific major version of chalk is mentioned in
package.json
, so the right copy of this dependency is resolved when webextension-toolbox is called. If it’s v5 (ESM), a built versioncommand.ts
is using an async import or is using ESM itself.Current Behavior
A ‘random’ version of chalk is picked, depending of the downstream project’s dependency tree. If that is v4 or less, then everything works. If that is v5.0.0 or greater, the tool crashes.
Steps to Reproduce (for bugs)
Happy to provide these a bit later if needed
Context
Trying to run
webextension-toolbox build
Your Environment
The text was updated successfully, but these errors were encountered: