-
-
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
Fix CSS order when merging type change bundles #8766
Conversation
|
||
let css = await outputFS.readFile(path.join(distDir, 'index.css'), 'utf8'); | ||
assert.ok(css.indexOf('.c {') < css.indexOf('.local {')); | ||
assert.ok(css.indexOf('.local {') < css.indexOf('.index {')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previous order was c, index, local. now order is c, local, index.
@@ -353,6 +353,7 @@ describe('css modules', () => { | |||
assert(css.includes('height: 100px;')); | |||
assert(css.includes('height: 300px;')); | |||
assert(css.indexOf('_test') < css.indexOf('_intermediate')); | |||
assert(css.indexOf('_intermediate') < css.indexOf('_composes5')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously composes5 was first, now it's last as expected.
Benchmark ResultsKitchen Sink ✅
Timings
Cold Bundles
Cached BundlesNo bundle changes detected. React HackerNews ✅
Timings
Cold BundlesNo bundle changes detected. Cached BundlesNo bundle changes detected. AtlasKit Editor ✅
Timings
Cold BundlesNo bundle changes detected. Cached BundlesNo bundle changes detected. Three.js ✅
Timings
Cold BundlesNo bundle changes detected. Cached BundlesNo bundle changes detected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good, just realized we need to alter bundle size here as well as adding the asset, I'll add that in another PR
* upstream/v2: (33 commits) v2.8.3 Changelog for v2.8.3 Address bug by updating an asset reference and merge conditions (parcel-bundler#8762) Fix CSS order when merging type change bundles (parcel-bundler#8766) fixing failing build for contributors on Linux using Node 18 (parcel-bundler#8763) Extension: Importers View and separate LSP protocol package (parcel-bundler#8747) Bump swc to fix sourcemaps with Windows line endings (parcel-bundler#8756) Apply HMR updates in topological order (parcel-bundler#8752) Make extension packaging work (parcel-bundler#8730) Typed api.storeResult (parcel-bundler#8732) Refactor LSP to use vscode-jsonrpc (parcel-bundler#8728) Bump swc (parcel-bundler#8742) Recursively check reachability when removing asset graphs from bundles in deduplication (parcel-bundler#6004) Fix tsc sourcemaps metadata (parcel-bundler#8734) Assigning to `this` in CommonJS (parcel-bundler#8737) Don't retarget dependencies if a symbol is imported multiple times with different local names (parcel-bundler#8738) Add a note about using flow in CONTRIBUTING.md (parcel-bundler#8731) filter out title execArgv to workers (parcel-bundler#8719) Document more of the BundleGraph class (parcel-bundler#8711) Fixed the hmr connection with host 0.0.0.0 (parcel-bundler#7357) ...
This fixes a bug when merging type change bundles that could result in CSS being bundled in the wrong order. We need to merge the contents of later bundles into earlier bundles, not the other way around.
I think this was potentially a workaround for an issue with CSS modules where there was no dependency in the CSS asset to
composes
deps, only in the JS, which left the graph in a weird state. I don't remember why that was the case, but now the dependency is in both places which fixes the problem. The test output was also slightly incorrect before anyway.