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
Failed to import @segment/analytics-next, Got unexpected undefined #9044
Comments
Can you provide a complete reproduction? Just import { AnalyticsBrowser } from "@segment/analytics-next";
console.log(AnalyticsBrowser); builds fine for me |
Here's the full stack trace:
And reproduction: https://github.com/louisgv/bug-parcel-segment mb I should have mentioned the usage of web-extension config! |
This sounds like it was working before upgrading for you, but I get the same error with 2.8.3? So I don't think it's related to the bitset? |
Interesting, I do have a custom resolver that lookup tsconfig's path for my project. When using 2.8.3 I tested swapping out the BitSet implementation vs the Set implementation and the Set works while the BitSet didn't work. The only place I found in the debugger that shows a diff in the heap was the reusable set - namely it included an extra item when importing segment's package with their weird middleware thingy... I traced upward a bit more to figure out what's adding stuff to that set, and the only place would be here: But reverting it doesn't do anything xD..... Maybe the ContentGraph edge lookup might be incompatible with BitSet somehow?.... :d |
I don't really know how to test if the output works, but Parcel builds successfully after upgrading to "@parcel/config-default": "2.10.3",
"@parcel/config-webextension": "2.10.3",
"parcel": "2.10.3" |
🐛 bug report
When importing
@segment/analytics-next
, parcel bundler throws an error.🎛 Configuration (.babelrc, package.json, cli command)
🤔 Expected Behavior
It should resolve the dependency correctly like the Set implementation but faster.
😯 Current Behavior
The new bundler using BitSet has a bug filtering out reusable dependency. Particularly the stack trace pointed me to this code:
https://github.com/parcel-bundler/parcel/blob/v2/packages/bundlers/default/src/DefaultBundler.js#L926-L943
After some debugging, it shows that the
reachableRoots
contains extra edge compared to the previous plain Set version. In particular with segment, it included an extra js assets that's actually not reachable, causing that else statement to throw at line 933.💁 Possible Solution
Reverting back to the Set implementation worked. I think there might be a bug with the BitSet implementation.
🔦 Context
💻 Code Sample
🌍 Your Environment
The text was updated successfully, but these errors were encountered: