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

Consuming of ES modules in extensions #131435

Closed
igorskyflyer opened this issue Aug 23, 2021 · 5 comments
Closed

Consuming of ES modules in extensions #131435

igorskyflyer opened this issue Aug 23, 2021 · 5 comments
Labels
*duplicate Issue identified as a duplicate of another issue(s)

Comments

@igorskyflyer
Copy link

When developing extensions and using either JavaScript or TypeScript we are unable to consume ES modules, only somewhat legacy CommonJS modules, setting the type to module and rewriting the extension to use import instead of require breaks the extension, generating an exception that states that all modules should use import instead of require in internal VS Code JavaScript files, I conclude it's caused by the type: module that forces Node to treat all .js files as ES modules. Tried using TypeScript which transpiles its own syntax to CommonJS module - so that's a no, I have also tried using just .mjs extension, again the same issue.

What is the status of this issue and are there plans to enable using of ES modules in extension development? That (could) bring somewhat big performance gains when bundling extensions with, for example, esbuild because it would enable tree-shaking - dead code removal, thus loading only necessary code. But I think this is not an extension API only issue, right? This needs to be done for VS Code itself?

@vscodebot
Copy link

vscodebot bot commented Aug 23, 2021

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@igorskyflyer
Copy link
Author

Repost of #130367 since no response was given.

@jrieken
Copy link
Member

jrieken commented Aug 24, 2021

/duplicate of #130367

@jrieken
Copy link
Member

jrieken commented Aug 24, 2021

just reopen the original issue

@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

3 participants
@jrieken @igorskyflyer and others