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

Fix ESM exports #78

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

remcohaszing
Copy link

@remcohaszing remcohaszing commented Aug 21, 2023

This uses the package.json exports field to support native ESM. The module field is redundant and can even lead to compatibility issues, so it was removed.

TypeScript project references are used for building the project with two different settings. An additional package.json is written to mark the ESM output as actual ESM. Since ESM requires file extensions, those were added to all imports.

Mocha has been reconfigured to run tests for both CJS and ESM.

Also ESLint has been configured to lint all files in the repo, not just a shell specific glob pattern. As a result, this change contains some small ESLint fixes.

Closes #56
Closes #57

@graham-atom
Copy link

any idea on when this will merge?

@Yokozuna59
Copy link

Is there any updates on this PR? The workaround stated in #57 for esbuild build:

{
  // ...
  mainFields: ["module", "main"]
}

broke other parts, so the only way to resolve such error would be with this approach.

This uses the `package.json` `exports` field to support native ESM. The
`module` field is redundant and can even lead to compatibility issues,
so it was removed.

TypeScript project references are used for building the project with two
different settings. An additional `package.json` is written to mark the
ESM output as actual ESM. Since ESM requires file extensions, those were
added to all imports.

Mocha has been reconfigured to run tests for both CJS and ESM.

Also ESLint has been configured to lint all files in the repo, not just
a shell specific glob pattern. As a result, this change contains some
small ESLint fixes.
@remcohaszing
Copy link
Author

I rebased and added the module export condition, like in microsoft/vscode-languageserver-node#1386

@remcohaszing
Copy link
Author

This is also blocking some downstream issues mentioned in microsoft/vscode#192144

@afonsojramos
Copy link

Hi @aeschli, who needs to review this?

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.

difficulty bundling with esbuild
5 participants