diff --git a/docs/webpack.md b/docs/webpack.md index 9d4a812c2..dc59e4de6 100644 --- a/docs/webpack.md +++ b/docs/webpack.md @@ -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. @@ -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. diff --git a/packages/webpack/loader.js b/packages/webpack/loader.js index ff94a35e3..870120012 100644 --- a/packages/webpack/loader.js +++ b/packages/webpack/loader.js @@ -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( diff --git a/packages/webpack/package.json b/packages/webpack/package.json index 538fc16ad..361483aa0 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -20,7 +20,7 @@ ], "devDependencies": { "test-utils": "^8.0.0", - "webpack": "^3.5.6" + "webpack": "^4.1.0" }, "dependencies": { "esutils": "^2.0.2", diff --git a/packages/webpack/test/__snapshots__/simple.json b/packages/webpack/test/__snapshots__/simple.json index 704b00a65..3e1f83563 100644 --- a/packages/webpack/test/__snapshots__/simple.json +++ b/packages/webpack/test/__snapshots__/simple.json @@ -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, @@ -16,8 +17,9 @@ "main": 0 }, "byBlocks": {}, - "usedIds": { - "0": 0 - } + "usedIds": [ + 0 + ], + "bySource": {} } } \ No newline at end of file