Skip to content

Commit a7dee8c

Browse files
kevinchappellevilebottnawi
authored andcommitted
fix(options): enable using plugin without defining options (#393)
1 parent 13e9cbf commit a7dee8c

File tree

6 files changed

+31
-13
lines changed

6 files changed

+31
-13
lines changed

package-lock.json

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

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class CssModuleFactory {
120120
}
121121

122122
class MiniCssExtractPlugin {
123-
constructor(options) {
123+
constructor(options = {}) {
124124
this.options = Object.assign(
125125
{
126126
filename: DEFAULT_FILENAME,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
body { background: red; }
2+

test/cases/default-options/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './style.css';

test/cases/default-options/style.css

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
body { background: red; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
plugins: [new Self()],
14+
};

0 commit comments

Comments
 (0)