Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/bundlers/default/src/DefaultBundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ function createIdealGraph(

// Create shared bundles for splittable bundles.
if (reachable.length > config.minBundles) {
let sourceBundles = reachable.map(a => nullthrows(bundles.get(a.id)));
let sourceBundles = reachable.map(a => nullthrows(bundleRoots.get(a))[0]);
let key = reachable.map(a => a.id).join(',');
let bundleId = bundles.get(key);
let bundle;
Expand Down
27 changes: 27 additions & 0 deletions packages/core/integration-tests/test/css-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,33 @@ describe('css modules', () => {
},
]);
});

it('should not fail with many css modules', async function () {
let b = await bundle(
path.join(__dirname, '/integration/css-modules-bug/src/index.html'),
);

assertBundles(b, [
{
name: 'index.html',
assets: ['index.html'],
},
{
type: 'js',
assets: [
'button.module.css',
'main.js',
'main.module.css',
'other.module.css',
],
},
{
type: 'css',
assets: ['button.module.css', 'main.module.css', 'other.module.css'],
},
]);
});

// Forked because experimental bundler will not merge bundles of same types if they do not share all their bundlegroups
it('should handle @import in css modules', async function () {
let b = await bundle(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.buttonPrimary {
align-self: center;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!DOCTYPE html>

<html lang="en">
<script src="main.js" type="module"></script>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as main from "./main.module.css";
import * as other from "./other.module.css";

console.log([main.main, other.other]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.main {
composes: buttonPrimary from "./button.module.css";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.other {
composes: buttonPrimary from "./button.module.css";
}