Skip to content

Commit 97ca207

Browse files
AvraamMavridisjoshwiens
authored andcommitted
docs: update to webpack 2 syntax
1 parent d4ec33e commit 97ca207

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

README.md

+16-14
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ With this configuration:
3636
```js
3737
{
3838
module: {
39-
loaders: [
40-
{ test: /\.jpg$/, loader: "file-loader" },
41-
{ test: /\.png$/, loader: "url-loader?mimetype=image/png" }
39+
rules: [
40+
{ test: /\.jpg$/, use: [ "file-loader" ] },
41+
{ test: /\.png$/, use: [ "url-loader?mimetype=image/png" ] }
4242
]
4343
},
4444
output: {
@@ -86,16 +86,18 @@ minimized by running `webpack --optimize-minimize`
8686
data-src=data:image/png;base64,...>'
8787
```
8888

89-
or specify the `minimize` query in your `webpack.conf.js`
89+
or specify the `minimize` property in the rule's options in your `webpack.conf.js`
9090

9191
```js
9292
module: {
93-
loaders: [{
93+
rules: [{
9494
test: /\.html$/,
95-
loader: 'html-loader',
96-
query: {
97-
minimize: true
98-
}
95+
use: [ {
96+
loader: 'html-loader',
97+
options: {
98+
minimize: true
99+
}
100+
}],
99101
}]
100102
}
101103
```
@@ -173,10 +175,10 @@ var path = require('path')
173175
module.exports = {
174176
...
175177
module: {
176-
loaders: [
178+
rules: [
177179
{
178180
test: /\.html$/,
179-
loader: "html-loader"
181+
use: [ "html-loader" ]
180182
}
181183
]
182184
},
@@ -194,10 +196,10 @@ If you need to define two different loader configs, you can also change the conf
194196
module.exports = {
195197
...
196198
module: {
197-
loaders: [
199+
rules: [
198200
{
199201
test: /\.html$/,
200-
loader: "html-loader?config=otherHtmlLoaderConfig"
202+
use: [ "html-loader?config=otherHtmlLoaderConfig" ]
201203
}
202204
]
203205
},
@@ -225,7 +227,7 @@ will write the _.html_ file for you. Example:
225227
```js
226228
{
227229
test: /\.html$/,
228-
loader: 'file-loader?name=[path][name].[ext]!extract-loader!html-loader'
230+
use: [ 'file-loader?name=[path][name].[ext]!extract-loader!html-loader' ]
229231
}
230232
```
231233

0 commit comments

Comments
 (0)