-
-
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
Recognize new URL("./thing.png", import.meta.url)
#5473
Comments
Hello @mischnic 😉 I’m not sure you will need help on this but I implemented this as a Rollup plugin so I would be glad to participate if necessary |
Thanks! I haven't looked into this further but I think we already have all the needed architecture (copying/hashing files, ...) and this is essentially an alias for |
Should that always create a dependency or only when used in contexts that already create one (eg workers). What if you want to create a URL relative to the actual bundle as would happen today? |
If we go by the principle "executing the source should behave just like executing the Parcel output", it should always be processed. |
We'd need to change the dependency based on where it's used though in order for the correct context to be applied, which may be hard. eg let url = new URL("./worker.js", import.meta.url);
let worker = new Worker(url); And what happens if the url is used in multiple places? |
My suggestion was:
Otherwise, there is no way to easily determine how it's used. |
@devongovett are you still looking into this? Do you have a WIP? |
🙋 feature request
As introduced by Webpack.
🤔 Expected Behavior
Behave like
import ... from "url:./thing.png"
.💁 Possible Solution
Should be implemented here: https://github.com/parcel-bundler/parcel/blob/v2/packages/transformers/js/src/visitors/dependencies.js
🔦 Context
This isn't related to
new Worker(new URL(...))
: #5430, because we need to detect the environment contextweb-worker
in that case.The text was updated successfully, but these errors were encountered: