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

Update dependencies that require ESM #3451

Closed
2 of 3 tasks
Tracked by #2964
nolanlawson opened this issue Apr 6, 2023 · 2 comments · Fixed by #3509 or #4128
Closed
2 of 3 tasks
Tracked by #2964

Update dependencies that require ESM #3451

nolanlawson opened this issue Apr 6, 2023 · 2 comments · Fixed by #3509 or #4128
Labels
enhancement Up for grabs Issues that are relatively small, self-contained, and ready for implementation

Comments

@nolanlawson
Copy link
Collaborator

nolanlawson commented Apr 6, 2023

Right now we have several dependencies that we can't update, because they rely on ES Modules rather than CommonJS:

  • parse5
  • estree-walker
  • webdriverio

(For webdriverio it's less severe, since it's only a devDep.)

I see two options for solving this:

  1. Drop CommonJS support in Node packages, use "type": "module" #3017
  2. Bundle these dependencies into our dist files (e.g. with Rollup)

#1 would be the simplest solution, but it's a breaking change. And I'm not sure how realistic it is, given Jest's lack of mainstream support for ESM. (E.g. would it even be possible to import @lwc/compiler into a jest.config.js file, if it's "type": "module"?)

#2 is kind of gross, but may be the most pragmatic solution. We can continue to ship both CJS and ESM as we do today, without breaking downstream consumers of our npm package.

@nolanlawson
Copy link
Collaborator Author

A third option is to use dynamic import() to import the ESM package from CommonJS. But this seems unfeasible given that we expose synchronous APIs. (Or our async APIs are deprecated, e.g. transform is deprecated in favor of transformSync.)

@nolanlawson
Copy link
Collaborator Author

We have already effectively started doing this, by bundling deps directly into our output.

The last one we haven't done yet is estree-walker.

@nolanlawson nolanlawson added Up for grabs Issues that are relatively small, self-contained, and ready for implementation enhancement labels Oct 19, 2023
nolanlawson added a commit that referenced this issue Apr 8, 2024
nolanlawson added a commit that referenced this issue Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Up for grabs Issues that are relatively small, self-contained, and ready for implementation
Projects
None yet
1 participant