Skip to content

Commit

Permalink
fix: issue 701
Browse files Browse the repository at this point in the history
  • Loading branch information
cap-Bernardito committed Feb 17, 2021
1 parent 6009bd2 commit 0997a13
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/index.js
Expand Up @@ -535,7 +535,11 @@ class MiniCssExtractPlugin {
? Array.from(this.getChunkModules(chunk, chunkGraph)).filter(
(module) => module.type === MODULE_TYPE
)
: chunkGraph.getChunkModulesIterableBySourceType(chunk, MODULE_TYPE);
: chunkGraph.getOrderedChunkModulesIterableBySourceType(
chunk,
MODULE_TYPE,
webpack.util.comparators.compareModulesByIdentifier
);

if (modules) {
const { hashFunction, hashDigest, hashDigestLength } = outputOptions;
Expand Down
@@ -0,0 +1,8 @@
.a {
width: 100px;
}

.b {
width: 100px;
}

@@ -0,0 +1,8 @@
.b {
width: 100px;
}

.a {
width: 100px;
}

7 changes: 7 additions & 0 deletions test/cases/content-entries-with-same-import/index.js
@@ -0,0 +1,7 @@
const app1 = import('./one');
const app2 = import('./two');

// eslint-disable-next-line no-console
console.log(app1);
// eslint-disable-next-line no-console
console.log(app2);
4 changes: 4 additions & 0 deletions test/cases/content-entries-with-same-import/one.js
@@ -0,0 +1,4 @@
import './style1.css';
import './style2.css';

export default 'one';
3 changes: 3 additions & 0 deletions test/cases/content-entries-with-same-import/style1.css
@@ -0,0 +1,3 @@
.a {
width: 100px;
}
3 changes: 3 additions & 0 deletions test/cases/content-entries-with-same-import/style2.css
@@ -0,0 +1,3 @@
.b {
width: 100px;
}
4 changes: 4 additions & 0 deletions test/cases/content-entries-with-same-import/two.js
@@ -0,0 +1,4 @@
import './style2.css';
import './style1.css';

export default 'two';
21 changes: 21 additions & 0 deletions test/cases/content-entries-with-same-import/webpack.config.js
@@ -0,0 +1,21 @@
import Self from '../../../src';

module.exports = {
entry: './index.js',
module: {
rules: [
{
test: /\.css$/,
use: [Self.loader, 'css-loader'],
},
],
},
output: {
filename: '[name].[contenthash].js',
},
plugins: [
new Self({
filename: '[name].[contenthash].css',
}),
],
};

0 comments on commit 0997a13

Please sign in to comment.