Recognize `new URL("./thing.png", import.meta.url)`
See original GitHub issue🙋 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(...)): https://github.com/parcel-bundler/parcel/issues/5430, because we need to detect the environment context web-worker in that case.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (5 by maintainers)
Top Results From Across the Web
import.meta - JavaScript - MDN Web Docs
meta meta -property exposes context-specific metadata to a JavaScript module. It contains information about the module, such as the module's URL.
Read more >import.meta.glob() can only accept string literals - Stack Overflow
i get the error import.meta.glob() can only accept string literals". How can I load all images url from folder with a dynamic folder...
Read more >Features | Vite
Rewrite the imports to valid URLs like /node_modules/.vite/deps/my-dep.js?v=f3sf2ebd so that the browser can import them properly.
Read more >Using Webpack Asset Modules - ReScript Forum
var logo = new URL("./logo.png", import.meta.url);. CAN THIS BE SIMPLER? I was wondering if there might be a simpler way to ...
Read more >Webpack 5 release (2020-10-10)
import url from "./image.png" and setting type: "asset" in module.rules when matching such import. (old way); new ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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
url:imports.@devongovett are you still looking into this? Do you have a WIP?