Skip to content

Commit 0bacfac

Browse files
lbennett-stackievilebottnawi
authored andcommitted
fix(options): use filename mutated after instantiation (#430)
1 parent 87d929e commit 0bacfac

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class MiniCssExtractPlugin {
124124
this.options = Object.assign(
125125
{
126126
filename: DEFAULT_FILENAME,
127-
moduleFilename: () => options.filename || DEFAULT_FILENAME,
127+
moduleFilename: () => this.options.filename || DEFAULT_FILENAME,
128128
ignoreOrder: false,
129129
},
130130
options
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
body {
2+
background: palegreen;
3+
}
4+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './style.css';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background: palegreen;
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const Self = require('../../../');
2+
3+
module.exports = {
4+
entry: {
5+
main: './index.js',
6+
},
7+
module: {
8+
rules: [
9+
{
10+
test: /\.css$/,
11+
use: [Self.loader, 'css-loader'],
12+
},
13+
],
14+
},
15+
output: {
16+
filename: '[name].js',
17+
},
18+
plugins: [
19+
(() => {
20+
const self = new Self({ filename: 'constructed.css' });
21+
22+
self.options.filename = 'mutated.css';
23+
24+
return self;
25+
})(),
26+
],
27+
};

0 commit comments

Comments
 (0)