-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
Explore AMD to ESM migration #160416
Comments
This comment was marked as resolved.
This comment was marked as resolved.
Hey @jrieken where would this leave extensions? Would there be a path for them to export esm? I believe right now they still export to commonjs because electron does not support esm |
@jasonwilliams For now extensions aren't affected by this and for the time being commonjs is how they roll. Tho, I am learning a ton and there will be a path for ESM extensions. We ignore this to keep this already large effort smaller. Also, if you wonder why this is complex: when extensions call |
@jrieken thanks for your response on this, looking forward to seeing what solution you come up with. I agree keeping extensions out makes things a lot easier.
Would import maps not help with this? Extensions already don’t bundle “vscode” and leave it as an external reference. |
Yeah, import maps is our only viable option for this. Fingers crossed for Safari landing this in time for us |
If Safari doesn't support this, is core team blocked by the few months it takes for browser updates to percolate to userland? See Google Chrome 110 popularity vs Google Chrome 109 here: https://www.stetic.com/market-share/browser/ |
As an update, the electron version is now on an ESM-supportable version, but the loader still needs to be fixed to enable it. This is no longer an external dependency now however. |
I will be very glad when this is resolved. I have a component of a project on hold until this can be resolved. |
Things for July
|
|
@bpasero I encountered the same error. It seems the issue is that In var $jscomp = { scope: {}, global: this }, // this is undefined
Symbol;
$jscomp.initSymbol = function () {
$jscomp.global.Symbol || (Symbol = $jscomp.Symbol); // error occurs here
$jscomp.initSymbol = function () {};
}; When accessing There is a PR here microsoft/vscode-loader#58 that might fix it. |
Thanks for the insights, maybe I am missing something but in the |
Thanks for the reply. I thought it might still be required, e.g. when an extension uses But I think you're also right that the same issue applies to the amdX loader. Before, A possible workaround could be to manually overwrite the jschardet code: var $jscomp = { scope: {}, global: globalThis }, // change here
Symbol;
$jscomp.initSymbol = function () {
$jscomp.global.Symbol || (Symbol = $jscomp.Symbol);
$jscomp.initSymbol = function () {};
}; |
We fake |
@SimonSiefke The I didn't get to the bottom of this yet, it is a really weird error. Things work when using the non-minified version which I'll do for now |
@jrieken you're right. It looks like It seems only the |
With xtermjs/xterm.js#5092 xterm.js now ships an ESM module. |
Re For now I think its OK to use the non-minified release. Eventually we should consider to minify all our node module dependencies in our pipeline and not depend on how others do it. Reported as aadsm/jschardet#97 |
The VS Code project uses AMD (asynchronous module definition) which is somewhat of a pre-runner of native JS modules (ESM). AMD is mostly dead technology and we should migrate away from it. Our TypeScript sources are written with ESM imports/exports but we took a few dependencies on AMD as a "runtime" and we need to understand what it takes to move towards ESM.
High-level topics:
require.toUrl
to locate sibling resources, like images, this needs to migrate ontoimport.meta.url
The text was updated successfully, but these errors were encountered: