-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Parcel support for import.meta #3269
Comments
This isn't an error from Parcel but from babel. It seems like you have an older version of But I don't think it would work after it parsed successfully. Related: webpack/webpack#6719 |
Many thanks for the speedy response and update. I've been searching through the documentation, and the issues, and it appears that Parcel will run all code through Babel - Issue 1207 says this is a feature, not a bug (#1207). As I'm not looking for my code to run through Babel - the library I'm building won't be supporting IE/Edge - I'm happy to let this issue be closed as "will not fix" - unless this is something you want to include in Parcel at some point in the future. |
Yes.
Yes. |
The only standardized property on The spec specifically left const $29abfa2312$importMeta = {...import.meta, url: "......"}; Browsers that don't support I propose we add |
I was about to open issue asking for that. Right now it doesn't seem possible to write a valid ES module that also supports hot reload (because it needs to reference a "file-scoped" |
Cross-posting from the webpack issue: I think |
Yeah, the problem is, that doesn't truly replace the module, it can only replace what the module exports, and it cannot support default exports since they are not live bindings. We'd really need something more dynamic to truly support HMR with ES modules I think... π€ |
I would expect that parcel and webpack would generally compile it away and not leave those references in the output chunks. I think live bindings of default should also work as long as a let/var is exported as default..? |
Vite does use |
β Question
Are there any plans for Parcel to support the import.meta Javascript object in the near future?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import.meta
π¦ Context
I have a requirement to use Javascript's import.meta in my module code, which I then use to build a url string to download and start a web worker. My code is entirely ES6 modular.
π» Code Sample
const buildFilterWorker = function () {
};
Running Parcel leads to the following build error:
$ parcel index.html
Server running at http://localhost:1234
π¨ factory/filter.js:191:19: Support for the experimental syntax 'importMeta' isn't currently enabled (191:20):
189 | const buildFilterWorker = function () {
190 |
π Your Environment
The text was updated successfully, but these errors were encountered: