Skip to content

Commit 0997a13

Browse files
fix: issue 701
1 parent 6009bd2 commit 0997a13

File tree

10 files changed

+64
-2
lines changed

10 files changed

+64
-2
lines changed

Diff for: package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,11 @@ class MiniCssExtractPlugin {
535535
? Array.from(this.getChunkModules(chunk, chunkGraph)).filter(
536536
(module) => module.type === MODULE_TYPE
537537
)
538-
: chunkGraph.getChunkModulesIterableBySourceType(chunk, MODULE_TYPE);
538+
: chunkGraph.getOrderedChunkModulesIterableBySourceType(
539+
chunk,
540+
MODULE_TYPE,
541+
webpack.util.comparators.compareModulesByIdentifier
542+
);
539543

540544
if (modules) {
541545
const { hashFunction, hashDigest, hashDigestLength } = outputOptions;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.a {
2+
width: 100px;
3+
}
4+
5+
.b {
6+
width: 100px;
7+
}
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.b {
2+
width: 100px;
3+
}
4+
5+
.a {
6+
width: 100px;
7+
}
8+

Diff for: test/cases/content-entries-with-same-import/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const app1 = import('./one');
2+
const app2 = import('./two');
3+
4+
// eslint-disable-next-line no-console
5+
console.log(app1);
6+
// eslint-disable-next-line no-console
7+
console.log(app2);

Diff for: test/cases/content-entries-with-same-import/one.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import './style1.css';
2+
import './style2.css';
3+
4+
export default 'one';
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.a {
2+
width: 100px;
3+
}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.b {
2+
width: 100px;
3+
}

Diff for: test/cases/content-entries-with-same-import/two.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import './style2.css';
2+
import './style1.css';
3+
4+
export default 'two';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import Self from '../../../src';
2+
3+
module.exports = {
4+
entry: './index.js',
5+
module: {
6+
rules: [
7+
{
8+
test: /\.css$/,
9+
use: [Self.loader, 'css-loader'],
10+
},
11+
],
12+
},
13+
output: {
14+
filename: '[name].[contenthash].js',
15+
},
16+
plugins: [
17+
new Self({
18+
filename: '[name].[contenthash].css',
19+
}),
20+
],
21+
};

0 commit comments

Comments
 (0)