-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiple css bundles in Entry bundle groups issue (#9023)
* initial attempt to fix * remedy resulting failing tests * add alternative test case * only duplicate css in case of needstablename and non perfect overlap of bundlegroups, revert test cases * remote bitset import
- Loading branch information
Showing
12 changed files
with
231 additions
and
4 deletions.
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