-
-
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
url:
imports fail with Could not resolve bundle with id
#7609
Comments
lazy.e20bce0f.js:1 Uncaught (in promise) Error: Could not resolve bundle with id 2vcPw
url:
imports fail with Could not resolve bundle with id
I debugged this a bit and the problem is that this register function isn't called with an object mapping That should be done by parcel/packages/runtimes/js/src/JSRuntime.js Line 542 in e0440dc
parcel/packages/runtimes/js/src/JSRuntime.js Line 234 in e0440dc
|
I see that @mischnic has arrived, very cool :) Here's just some more stuff I found that might help: Something's wrong with some graph. You can see that Here
in bundleGraph.#graph._graph.nodes[19] the SVG |
Hey, In my case it only happens in production build when loading the page. The parcel build process itself works.
|
I stepped a bit further and here is where it adds the reference to the unexisting SVG: parcel/packages/runtimes/js/src/JSRuntime.js Line 191 in e0440dc
DUnno where the place where it's missing is though |
@danieltroger thanks for digging. |
I had a ton of issues too when targetting ie11, even without url imports. I think the url imports breaking are just another symptom of the issue. It doesn't break for me in dev mode, so you need to clear cache and build every time to reproduce it. Use ndb and npm and then you should be able to add debugger statements in |
I tried now version 2.3.1 and 2.0.1 with no success, same issue. EDIT: |
@spointecker The fix seems to be to disable scope hoisting ( Found in #4222 (comment) while searching around. It seems that scope hoisting has a hard time with SVG URL imports, and disabling scope hoisting solves the issue. I tested in 2.3.2 with the import logo1 from "url:logo.svg";
const logo2 = new URL('logo.svg', import.meta.url); |
Scope hoisting is one of the reasons I'm using parcel because not having it increases bundle size so unfortunately that's not an option for me :( |
As @danieltroger already mentioned that is not an option for our production builds. |
I'm also seeing this issue with my service worker. The service worker fails to register and logs the same |
I just tried #7609 (comment) and that did work fine for me even with scopehoisting on 2.8.0. Is everyone else also using an inline script ( |
The service worker issues turned out to be terser related. That's working now as long as I don't scope hoist.
I am unable to build at all with 2.8.0. I'm seeing this behavior on 2.7.0. On 2.80, I've got the "Bundle group cannot have more than one entry bundle of the same type" issue. I am building a javascript entry point that registers a service worker. This file is then being imported into a legacy codebase like this:
I also tried it with I took a look at
Yet, in
I'm thinking my issue is related to the fact that the service worker imports the same module that also handles the registration. It appears the scope-hoisting is deciding to remove that bundle, which makes sense because the service worker will never execute the code to register a new service worker. However, for some reason it is still attempting to resolve it. I see that variable is used inside the function:
But it that the resolve is happening at the top level of the module. I'll see if I can break this module up in a way where the service worker registration code can be cleanly removed from the bundle so the service-worker doesn't try and fail to resolve itself. |
I was able to handle the service worker registration in an isolated module and pull that into my JS entrypoints and not the service worker. That got me past the issue. |
Getting this bug on 2.8.0 on build, but 2.7.0 works fine. |
Just to keep this fresh: I've encountered this issue, too. --no-scope-hoist doesn't solve the problem. |
got this due to a circle dependency between a worker module and the initiator |
Hi people, the easiest solution to this issue would be downgrading plasmo to 8.0. I've literally spent 2 days looking for a solution. Just change the version from 8.x to 8.0 in the package.json and then reinstall it using your package manager, |
🐛 bug report
It seems like #4365 has risen from the dead.
When having a
<script>
tag withtype="module"
which imports something which lazily imports something which imports something using theurl:
scheme, running the code results in a runtime error.🎛 Configuration (.babelrc, package.json, cli command)
package.json:
cli command:
yarn install && yarn build && http-server -p 1234 dist/
🤔 Expected Behavior
The URL to the SVG should be logged to the console.
😯 Current Behavior
💁 Possible Solution
Fix so that it no longer throws but instead correctly gives the URL of the SVG.
Alternatively, please fix #5683 which forced me to use a
<script>
tag instead of<script src="
and triggered this error.🔦 Context
Was happily on parcel 2.0.1. Then my colleague wanted to import a style sheet per module on our react project. Reason being readability and that unused CSS doesn't load too early.
It worked out of the box (like parcel usually does) 😋 but the precedence was wrong.
When doing
in entrypoint:
in script.ts:
The output bundle first contained high-precedence and then low-precedence, making it impossible to override general styling without making every selector more specific.
I was about to report an issue but then I discovered https://github.com/parcel-bundler/parcel-css, which fixed all issues and made the scss build time much faster 🎉
Buuutt to install that I had to update to the latest parcel, where I was greeted with #5683.
After figuring out the workaround I thought I could finally be happy but then this happened 😔
💻 Code Sample
parcel_lazy_error.zip
🌍 Your Environment
The text was updated successfully, but these errors were encountered: