From e729c5474c5dd8e473c3e5f975faab0405733f9a Mon Sep 17 00:00:00 2001 From: Stephen Niedzielski Date: Tue, 3 Sep 2019 20:59:38 -0600 Subject: [PATCH] [doc] Update config usage for Webpack v4 For configuration, use rules instead of loaders and add type. https://stackoverflow.com/a/49083832/970346 https://github.com/webpack/webpack/releases/tag/v4.0.0 --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b6032a1..807da1a 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ $ npm install json5-loader --save-dev You can use the loader either: -- by configuring the `json5-loader` in the `module.loaders` object of the webpack configuration, or +- by configuring the `json5-loader` in the `module.rules` object of the webpack configuration, or - by directly using the `json5-loader!` prefix to the require statement. Suppose we have the following `json5` file: @@ -44,7 +44,7 @@ Suppose we have the following `json5` file: } ``` -### Usage with preconfigured loader +### Usage with preconfigured rule **webpack.config.js** @@ -56,11 +56,12 @@ module.exports = { /* ... */ }, module: { - loaders: [ + rules: [ { // make all files ending in .json5 use the `json5-loader` test: /\.json5$/, - loader: 'json5-loader', + use: 'json5-loader', + type: 'javascript/auto' }, ], },