-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Only use import.meta when strictly necessary #8940
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
Conversation
A webworker ES6 module doesn't have access to 'document.currentScript'. 'import.meta' was the only way I could see to achieve that functionality.
The one test failure is |
I don't quite understand this (sorry, I couldn't follow the discussion in the other issue either). Can you please summarize, assuming a reader that isn't familiar with ES6? :)
What do you mean by "tooling" here? Which tools? |
I'm the one who brought up tooling so I can chime in here... Tooling is mostly build/lint tools for the javascript ecosystem. For example:
And this is mainly because much of the javascript tooling that exists state that they only support TC39 stage 4 proposals and higher where import.meta.url is still at stage 3. This means that technically import.meta.url isn't even part of the ECMAScript spec yet, it's in the finalization process and once it gets to Stage 4 it will become part of the spec the following year. Browsers just like the feature enough that they have implemented it early but not everyone has. Yes there are people who provide plugins, polyfills and extensions to support many pieces of this new functionality but without these additions (and emscripten documenting that these additions are now required), the core tooling will not compile them. |
@k2snowman69 interesting, thanks! This looks ok to me, aside from the test failures. |
Great, thanks @VirtualTim! |
This fixes the problem reported by emscripten-core#9233 and by emscripten-core#8729 while fixing the regression bug causes by emscripten-core#8940
) A webworker ES6 module doesn't have access to 'document.currentScript'. 'import.meta' was the only way I could see to achieve that functionality. Fixes emscripten-core#8729. Since this appears to fix the issue for everyone who commented on emscripten-core#8729, and no one proposed any better ideas, this is my suggestion. It would be nice to use import.meta everywhere, and browsers seem to have good support, however the tooling appears to be lagging a bit behind.
…mscripten-core#9234) This fixes the problem reported by emscripten-core#9233 and by emscripten-core#8729 while fixing the regression bug causes by emscripten-core#8940
A webworker ES6 module doesn't have access to 'document.currentScript'. 'import.meta' was the only way I could see to achieve that functionality.
Fixes #8729.
Since this appears to fix the issue for everyone who commented on #8729, and no one proposed any better ideas, this is my suggestion.
It would be nice to use import.meta everywhere, and browsers seem to have good support, however the tooling appears to be lagging a bit behind.