8000 fix(options): use filename mutated after instantiation (#430) · jsGood/mini-css-extract-plugin@0bacfac · GitHub
Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0bacfac

Browse files
lbennett-stackievilebottnawi
authored andcommitted
fix(options): use filename mutated after instantiation (webpack-contrib#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

Lines changed: 1 addition & 1 deletion
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
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
body {
2+
background: palegreen;
3+
}
4+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './style.css';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background: palegreen;
3+
}
Lines changed: 27 additions & 0 deletions
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)