-
-
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
Multiple css bundles in Entry bundle groups issue #9023
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
3997714
initial attempt to fix
AGawrys 1c17b66
remedy resulting failing tests
AGawrys f69e2cb
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys 09fd358
add alternative test case
AGawrys 3952f23
only duplicate css in case of needstablename and non perfect overlap …
AGawrys a6a4f84
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys a7fe037
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys 93397dd
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys 72db3bc
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys 342b2ec
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys ccb1b7b
remote bitset import
AGawrys c618ea9
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys abf2ea4
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys 5f1b78b
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys a5a711c
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys d5f07e4
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys c948792
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys 0c98c83
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys 3092c04
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys 850e46a
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys 0ca2488
Merge branch 'v2' into agawrys/multi-css-in-entry-bug
AGawrys File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/core/integration-tests/test/integration/multi-css-bug/src/Foo/foo.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.foo { | ||
outline: 1px solid red; | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/core/integration-tests/test/integration/multi-css-bug/src/Foo/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import './foo.css'; | ||
|
||
export default function () { return 'foo' }; |
35 changes: 35 additions & 0 deletions
35
packages/core/integration-tests/test/integration/multi-css-bug/src/entry.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// This repro was taken from https://github.com/parcel-bundler/parcel/issues/8813 | ||
|
||
// This file needs to import a CSS asset, so that `index.css` will be created. | ||
import './main.css'; | ||
|
||
/* | ||
Import the CSS out of the package; causes a bundle Group entry type error. | ||
This import causes the asset in the lazy imported bundle below to also be | ||
named `index.css`. | ||
*/ | ||
import './Foo/foo.css'; | ||
|
||
/* | ||
Due to the import above, the dynamic import CSS asset is also created as | ||
`index.css`, resulting in a name collision with the `index.css` asset created | ||
for this file. | ||
|
||
If the import of 'foo.css' above is removed, the dynamic import CSS asset | ||
will be named `Foo.<hash>.css` as expected, like its JS file. | ||
|
||
If the import of 'main.css' above is removed, the dynamic import CSS asset | ||
will be named `index.css` as expected, but there will be no name collision | ||
because this file did not generate an `index.css` asset itself. | ||
|
||
Also, if parcel is run with a cache, on the first execution the | ||
AssertionError for the bundle group will be raised. However, on a second | ||
execution, the AssertError will not occur, but the generated `index.css` will | ||
only contain the content of `foo.css` and be missing the content of | ||
`main.css`. | ||
|
||
In a React app, the dynamic import occurs via React.lazy: | ||
import {lazy} from 'react' | ||
const foo = lazy(() => import('./Foo')); | ||
*/ | ||
import('./Foo'); |
3 changes: 3 additions & 0 deletions
3
packages/core/integration-tests/test/integration/multi-css-bug/src/main.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.main { | ||
outline: 1px solid blue; | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/core/integration-tests/test/integration/multi-css-multi-entry-bug/src/Foo/foo.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.foo { | ||
outline: 1px solid red; | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/core/integration-tests/test/integration/multi-css-multi-entry-bug/src/Foo/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import './foo.css'; | ||
|
||
export default function () { return 'foo' }; |
8 changes: 8 additions & 0 deletions
8
packages/core/integration-tests/test/integration/multi-css-multi-entry-bug/src/entry.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// This repro was taken from https://github.com/parcel-bundler/parcel/issues/8813 | ||
|
||
import './main.css'; | ||
|
||
import './Foo/foo.css'; | ||
|
||
import('./Foo'); | ||
import('./index-sib'); |
2 changes: 2 additions & 0 deletions
2
packages/core/integration-tests/test/integration/multi-css-multi-entry-bug/src/index-sib.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
import './main.css'; |
3 changes: 3 additions & 0 deletions
3
packages/core/integration-tests/test/integration/multi-css-multi-entry-bug/src/main.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.main { | ||
outline: 1px solid blue; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
skipped?
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.
Oh forgot about this... okay yes so I still do have one more question. The current solution works with our existing test cases and fixes the cases in the mentioned issue. However, I added this case as an alternative and I'm not sure what our best move is. No one has encountered this to my knowledge yet.
In this test case, we have 1 entry (
entry.js
) with twoasync js
siblings, with which it shared two other.css
files (main
andfoo.css
)Both
foo.css
(3) andmain.css
(2) haveneedsStableName: true
but have no subset or perfect overlap in terms of bundleGroups. Should we over-fetch and merge them anyway or should we create a new bundle with duplicated just forentry.js
?AFAIK old bundler just inefficiently merged them.
cc: @devongovett