-
-
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
Regression in 2.9.0: @parcel/bundler-default: Got unexpected undefined for CSS modules #9058
Comments
Minimal reproduction: Archiv.zip Looks like having two CSS module assets that both have cc @AGawrys |
Is there anything the community can do to address this bug? |
I think I've run into this issue too - we use a combination of css, scss both with and without modules. We have a shared config that is used to build a bunch of small projects (without package.json) is a directory tree. I had parcel (and @parcel/*) pinned to 2.8.2 until recently, when I upgraded to 2.9.3. Today I realized some of the subprojects were failing to build with what looks like an identical error to what's mentioned in this issue. I didn't make the connection until just now that one of the successful builds uses an SCSS file in a style tag, but imports react components that are using (plain) CSS modules. One of the failures has an import using SCSS modules. I know that's not a lot to work off, but maybe it will help. This was working with 2.8.2. I tried 2.9.0, 2.9.1, and 2.9.2 and got the same errors with those, consistent with the OP. Since the error is happening (for me) here I just cheated, and used this config as a workaround for now: "@parcel/bundler-default": {
"minBundles": 1000
} It's unclear to me why this code would be hit. The entrypoint is an html file with a script tag pointing at a tsx file, and a style tag pointing at an scss file. Code splitting doesn't seem relevant here, but that probably just reflects my ignorance. |
Looking again, the graph for at least one of my failures looks something like this: graph TD;
A.tsx-->C.tsx;
A.tsx-->B.tsx;
B.tsx-->C.tsx;
C.tsx-->C.module.css
Is it possible that multiple unique paths to a CSS module triggers this? Maybe that's similar to the minimal repro above? EDIT: A very simple reproduction of this pattern worked fine. |
I'm seeing something similar to this issue right now on Parcel 2.9.3. I have two separate CSS modules, both of which Here's my
|
Ah, that makes sense. Thanks for explaining, @shepmaster. When I saw this issue was Closed I initially figured it would be released. On further inspection (and thought), I now see that the fix PR was merged and this Issue was closed in August 2023, but the last release (2.9.3) was on June 25, 2023. I'll stay tuned for the next release. Thanks for testing out the PR fix in the nightly builds! |
Landscape mode adjusted to show analyses to right of cards, resolving CSS modules introduced to keep the complexity of application CSS manageable. Local CSS variables not used due to bug in latest version of Parcel (parcel-bundler/parcel#9058). Candidate fix PR has been merged and is awaiting release in a future version of Parcel.
🐛 bug report
All of my parcel-using projects started getting this error when trying to upgrade to parcel 2.9.0 (and 2.9.1 as well):
🎛 Configuration (.babelrc, package.json, cli command)
I think I don’t set any babel configuration, and the only non-paths configuration is:
Since the projects are open-source, you can see all the details in their repositories.
🤔 Expected Behavior
The bundler should bundle these projects, since the previous version of bundler managed that.
😯 Current Behavior
Both
parcel watch
andparcel build
fail with the error "@parcel/bundler-default: Got unexpected undefined". It happens either inDefaultBundler.js:731:72
or inDefaultBundler.js:707:62
:People have reported other issues about "Got unexpected undefined" but they affect earlier versions, and they do not originate from the default bundler.
🔦 Context
The issue seems to be related to me using CSS modules extensively. I was investigating this failure, and it happens here when the
reachable
only contains two items[Asset(VerifiedFiles.module.css), Asset(FilesEmpty.module.css)]
and theirid
are both absent frombundles
.You might notice that the projects were using parcel@2.7.0 before the attempted upgrade. This is because of parcel bugs in 2.8.0 and 2.8.1 where the build has completed successfully, but the output referred to nonexistent constants.
💻 Code Sample
🌍 Your Environment
The text was updated successfully, but these errors were encountered: