question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mischniccommented, Dec 15, 2020

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.

0reactions
ProLosercommented, Jan 30, 2021

@devongovett are you still looking into this? Do you have a WIP?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found