Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chalk is an implicit dependency (should be explicit) #835

Closed
kachkaev opened this issue Dec 4, 2023 · 1 comment
Closed

Chalk is an implicit dependency (should be explicit) #835

kachkaev opened this issue Dec 4, 2023 · 1 comment
Assignees

Comments

@kachkaev
Copy link

kachkaev commented Dec 4, 2023

👋 folks! Great library! 💯 I’ve noticed one edge case and have decided to share it.

Chalk is used in command.ts:

import chalk from "chalk";

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
@kachkaev kachkaev changed the title Chalk is an implicit dependency Chalk is an implicit dependency (should be explicit) Dec 4, 2023
@tm1000 tm1000 self-assigned this Jan 7, 2024
@tm1000
Copy link
Member

tm1000 commented Jan 8, 2024

This is resolved in: #832

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

No branches or pull requests

2 participants