Skip to content

Commit

Permalink
fix: webpack 4 (#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
getkey authored and tivac committed Mar 8, 2018
1 parent e8adce6 commit 9c03206
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
6 changes: 3 additions & 3 deletions docs/webpack.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Webpack 2
# Webpack 2/3/4

`modular-css/webpack/plugin` provides a webpack 2 plugin you can use to transform imported `.css` files into lookup objects while outputting CSS to disk.
`modular-css/webpack/plugin` provides a webpack 2/3/4 plugin you can use to transform imported `.css` files into lookup objects while outputting CSS to disk.

`modular-css/webpack/loader` provides the file loader that does the actual transformation on files.

Expand Down Expand Up @@ -66,4 +66,4 @@ All other options are passed to the underlying `Processor` instance, see [Option

### `namedExports`

Set to `false` to disable named exports, instead only the default export wll be used. This is useful to avoid warnings when your classes aren't valid JS identifiers.
Set to `false` to disable named exports, instead only the default export will be used. This is useful to avoid warnings when your classes aren't valid JS identifiers.
4 changes: 3 additions & 1 deletion packages/webpack/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ var utils = require("loader-utils"),
module.exports = function(source) {
var options = utils.getOptions(this) || false,
done = this.async(),
processor = this.options.processor;
processor = this.options
? this.options.processor // Webpack 2 & 3
: this._compiler.options.processor; // Webpack 4

if(options.cjs) {
this.emitWarning(
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"devDependencies": {
"test-utils": "^8.0.0",
"webpack": "^3.5.6"
"webpack": "^4.1.0"
},
"dependencies": {
"esutils": "^2.0.2",
Expand Down
10 changes: 6 additions & 4 deletions packages/webpack/test/__snapshots__/simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"byIdentifier": {
"packages/webpack/test/specimens/simple.js": 0,
"packages/webpack/loader.js!packages/webpack/test/specimens/simple.css": 1,
"packages/webpack/loader.js??ref--0!packages/webpack/test/specimens/simple.css": 2
"packages/webpack/loader.js??ref--0!packages/webpack/test/specimens/simple.css": 2,
"packages/webpack/loader.js??ref--4!packages/webpack/test/specimens/simple.css": 1
},
"usedIds": {
"0": 0,
Expand All @@ -16,8 +17,9 @@
"main": 0
},
"byBlocks": {},
"usedIds": {
"0": 0
}
"usedIds": [
0
],
"bySource": {}
}
}

0 comments on commit 9c03206

Please sign in to comment.