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

Use import.meta.url in EXPORT_ES6 mode #7137

Closed
curiousdannii opened this issue Sep 17, 2018 · 4 comments
Closed

Use import.meta.url in EXPORT_ES6 mode #7137

curiousdannii opened this issue Sep 17, 2018 · 4 comments
Labels

Comments

@curiousdannii
Copy link
Contributor

Follow on to #5368. When in EXPORT_ES6 mode import.meta.url should be used. In browsers document.currentScript will probably still work, but __dirname will not work in Node. import.meta.url is supported in both, and it's cleaner and safer.

@saschanaz
Copy link
Collaborator

https://aremodulesready.com/ The availability for import.meta.url seems fairly limited yet 😢

@curiousdannii
Copy link
Contributor Author

curiousdannii commented Sep 17, 2018

It was just added in Firefox 62. Edge support is still lacking. Detecting its support could be tricky? I'm not sure if it will throw a syntax error in browsers which don't support it.

At the very least it's needed for Node, and supported in Node. Maybe leave browsers till later when it's reached stage 4.

@saschanaz
Copy link
Collaborator

saschanaz commented Sep 17, 2018

It's tricky because import.meta has a special syntactic form with a keyword so unsupported browsers will throw an early SyntaxError. Waiting Stage 4 makes sense, though.

@stale
Copy link

stale bot commented Sep 18, 2019

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants