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

Only use import.meta when strictly necessary #8940

Merged
merged 6 commits into from Jul 19, 2019

Conversation

VirtualTim
Copy link
Collaborator

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.

A webworker ES6 module doesn't have access to 'document.currentScript'. 'import.meta' was the only way I could see to achieve that functionality.
@VirtualTim
Copy link
Collaborator Author

The one test failure is test_glgears. Looks like a flaky test.

emcc.py Show resolved Hide resolved
@kripken
Copy link
Member

kripken commented Jul 12, 2019

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? :)

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.

What do you mean by "tooling" here? Which tools?

@k2snowman69
Copy link

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? :)

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.

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:

  • Babel core does not support this functionality yet so you explicitly have to add the @babel/plugin-syntax-import-meta
  • Webpack is the same and requires @open-wc/webpack-import-meta-loader

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.

@kripken
Copy link
Member

kripken commented Jul 17, 2019

@k2snowman69 interesting, thanks!

This looks ok to me, aside from the test failures.

@kripken
Copy link
Member

kripken commented Jul 19, 2019

Great, thanks @VirtualTim!

@kripken kripken merged commit f9e6cfe into emscripten-core:incoming Jul 19, 2019
@VirtualTim VirtualTim deleted the patch-7 branch July 20, 2019 05:10
adevress added a commit to adevress/emscripten that referenced this pull request Aug 14, 2019
    This fixes the problem reported by emscripten-core#9233 and by emscripten-core#8729 while fixing the
    regression bug causes by emscripten-core#8940
kripken pushed a commit that referenced this pull request Aug 21, 2019
…9234)

This fixes the problem reported by #9233 and by #8729 while fixing the
    regression bug causes by #8940
belraquib pushed a commit to belraquib/emscripten that referenced this pull request Dec 23, 2020
)

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.
belraquib pushed a commit to belraquib/emscripten that referenced this pull request Dec 23, 2020
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.

EXPORT_ES6 mode import.meta.url is not supported
3 participants