Conversation
Adam-it
left a comment
There was a problem hiding this comment.
Please let's get this shipped.
Creating VS Code Extension without native esm support is such a pain
|
@v4lentin1879 Could you please help me understand how this PR helps with loading VS Code extensions? AFAIK extension code loading happens via nodejs' require here and does not involve the AMD loader. |
|
@alexdima This repo is referenced in VSCode’s
Does that mean this repo is supposed to be updated before VSCode’s |
|
@alexdima I am referring to the discussion in this thread: #36. The issue is that esm modules cannot be imported in a static way in commonjs. Since vscode is still based on commonjs, we have to make use of dynamic imports in extensions in order to use esm modules. This works perfectly fine in the development environment as there the vscode-loader is not used, yes. However, when packaging the extension, dynamic imports will stop to work because that's where the vscode-loader comes into play. My PR simply implements the importModuleDynamically option to enable dynamic imports. |
|
VS Code 1.94 now ships the ESM build in the stable channel: I tested using ESM in extensiom code and that still appears to be unsupported, but hopefully VS Code now shipping ESM means this limitation will be lifted, soon. |
Currently, it is impossible to import ESM modules in a vscode extension as those require dynamic imports. This PR introduces the possibility of using dynamic imports in vscode. I'm looking forward to your feedback!
https://nodejs.org/api/vm.html#when-importmoduledynamically-is-a-function
#36