-
-
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
Error: Cannot read property 'hashReferences' of undefined #4145
Comments
Could you try again with the latest |
Same issue.
|
This error happens practically if not every time you change a configuration property from the package.json or elsewhere. |
To be honest I've been in the habit of removing the cache after every build as it seems to cause a lot of issues. So cache definitely isn't the problem here. |
Thanks for having an easily reproducible example @kevincox! I've opened a PR that I believe should solve this issue. Temporarily, it looks like building with |
I think I'm getting this error when my
|
I was getting this error on |
Can someone else confirm that this is fixed? |
I'm receiving the error when when two builds in a monorepo share the default cache location -- in this case the cache dir is at the root of the repository. If add |
In the beta I have the same problem. In the version |
I'm on I have a similar structure as @ross-pfahler (monorepo with two packages build built by parcel at the same time) Haven't tried 2.0.0-nigthly.3658 though |
I'm getting this error with In my case it happens when I try to import a file using a named pipeline, e.g. |
It would be great to at least display a more informative error message (showing which bundle is referenced that is not found). |
Can you reproduce this consistently? Could you provide a full code sample?
We should rather fix the bug itself.... |
Sure: https://gist.github.com/cifkao/badeda38164e362a147b571053920520
|
At least in @cifkao's example, this is caused by inline bundles not being processed (as they shouldn't)
so bundleInfoMap[someInlineBundle.id] is undefiend.But they are still listed in the hashReferences of their parent bundles:
and then bundleInfoMap[someInlineBundle.id].hashReferences fails. I'm not quite sure if they should just be skipped or handled in some other way.
|
I also get this error now too, but with JS instead of CSS. What seems to have triggered it for me is using ES6 static imports from inside an ES6 dynamic import which I had also imported in the document itself. The following minimal example reproduces: {edit} as a gist: https://gist.github.com/dgkimpton/278657a777eb898075b9551ff38606c2 package.json
index.html
module.mjs
othermodule.mjs
|
Yep this my problem too, i think we can't use ES6 Export/Import in Parcel. Feels Bad. Do you have any solution for this stuff? |
Also bumping this as an issue I am experiencing. Seems to be when main is unset in package.json? EDIT: Latest nightly is working |
I just encountered this (on |
Another reproduction: <script type="module">
import * as b from "./b.js";
console.log(b);
</script>
<script src="./a.js" type="module"></script> // a.js
import * as b from "./b.js";
console.log(b);
// b.js
export const a = 1; |
If building for ESM there is no solution or workaround :( |
I have a build where I had in my
When I remove the |
I can't reproduce with @mischnic's case in the latest nightly anymore. @GrantAtStreamba what version of Parcel are you using and do you have any more details on what could reproduce it? |
Going to close this since it seems to be working now. If you manage to reproduce it still, please let us know. |
The original case is still present https://gitlab.com/kevincox/playerone/-/merge_requests/1. I have rebased the example against Parcel 2.0.0. I have also found a new case on Parcel 2.0.0 that worked previously. https://gitlab.com/kevincox/playerone/-/merge_requests/65 which appears to be triggered by this import https://gitlab.com/kevincox/playerone/-/blob/72879318ae5db83cb3174871e50b281c297a5b95/src/a/options.ts#L1 |
Also experiencing this issue when trying to workaround #7609 by using
|
For me, falling back to |
Another confirmation for |
For me falling back on fs does not work, as I actually want Parcel to process imports in the CSS first =\ |
Ah interestingly - it only happens in
|
so removing |
But if I were to remove |
Running into the same issue during |
Same issue
[Jul 11, 2022] Update: The above doesn't really work. It makes the |
Has anyone been able to circumvent the issue? |
@everdimension @avalanche1 I think you may be hitting another bug - see #8071 |
For reference, a workaround in the linked issue can be found in this comment. I've also outlines that solution below. As mentioned in everdimension's comment, adding "@parcel/bundler-default": {
"minBundles": 10000000,
"minBundleSize": 3000,
"maxParallelRequests": 20
} Keep in mind that this solution removes code-splitting so you will end up with larger individual files. If you're developing a web extension this is generally not an issue since the files are loaded locally anyways. However, Firefox does have a hard limit of 4MB per file ([1], [2]), which could prevent this solution from working on the Firefox Addons site. |
For reference, a workaround in the linked issue can be found in this comment. I've also outlined that solution below. As mentioned in everdimension's comment, adding "@parcel/bundler-default": {
"minBundles": 10000000,
"minBundleSize": 3000,
"maxParallelRequests": 20
} Keep in mind that this solution removes code-splitting so you will end up with larger individual files. If you're developing a web extension this is generally not an issue since the files are loaded locally anyways. However, Firefox does have a hard limit of 4MB per file ([1], [2]), which could prevent this solution from working on the Firefox Addons site. Again, this is all outlined in various comments in the linked issue (#8071), which may the better place to track progress on a fix for this problem. |
@mischnic Will this get priority? |
🐛 bug report
When adding a synchronous dependency I get the following error:
🎛 Configuration (.babelrc, package.json, cli command)
All the state can be see in https://gitlab.com/kevincox/playerone/-/merge_requests/1.
In that PR I attempt to remove the workaround (using async imports) and you can see that it fails to build.
🤔 Expected Behavior
The build should work as intended.
💁 Possible Solution
This may be related to the fact that this library is imported from two places. The current graph looks like this (when experiencing the bug).
The text was updated successfully, but these errors were encountered: