Skip to content

Commit 336a4c0

Browse files
committed
update docs for webpack 2 new option usage
1 parent fcc02bd commit 336a4c0

File tree

3 files changed

+42
-29
lines changed

3 files changed

+42
-29
lines changed

docs/en/configurations/advanced.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,26 @@ module.exports = {
3030
}
3131
```
3232

33-
Webpack 2.x:
33+
Webpack 2.x (^2.1.0-beta.25):
3434

3535
``` js
36-
var webpack = require('webpack')
37-
3836
module.exports = {
39-
// ...
40-
plugins: [
41-
new webpack.LoaderOptionsPlugin({
42-
vue: {
43-
loaders: {
44-
// ...
37+
// other options...
38+
module: {
39+
// module.rules is the same as module.loaders in 1.x
40+
rules: [
41+
{
42+
test: /\.vue$/,
43+
loader: 'vue',
44+
// vue-loader options goes here
45+
options: {
46+
loaders: {
47+
// ...
48+
}
4549
}
4650
}
47-
})
48-
]
51+
]
52+
}
4953
}
5054
```
5155

docs/en/configurations/extract-css.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,35 @@ module.exports = {
3535
}
3636
```
3737

38-
### Webpack 2.x
38+
### Webpack 2.x (^2.1.0-beta.25)
3939

4040
``` bash
4141
npm install [email protected] --save-dev
4242
```
4343

4444
``` js
4545
// webpack.config.js
46-
var webpack = require('webpack')
4746
var ExtractTextPlugin = require("extract-text-webpack-plugin")
4847

4948
module.exports = {
5049
// other options...
51-
plugins: [
52-
new webpack.LoaderOptionsPlugin({
53-
vue: {
54-
loaders: {
55-
css: ExtractTextPlugin.extract({
56-
loader: 'css-loader',
57-
fallbackLoader: 'vue-style-loader' // <- this is a dep of vue-loader, so no need to explicitly install if using npm3
58-
})
50+
module: {
51+
rules: [
52+
{
53+
test: /\.vue$/,
54+
loader: 'vue',
55+
options: {
56+
loaders: {
57+
css: ExtractTextPlugin.extract({
58+
loader: 'css-loader',
59+
fallbackLoader: 'vue-style-loader' // <- this is a dep of vue-loader, so no need to explicitly install if using npm3
60+
})
61+
}
5962
}
6063
}
61-
}),
64+
]
65+
},
66+
plugins: [
6267
new ExtractTextPlugin("style.css")
6368
]
6469
}

docs/en/options.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,22 @@ module.exports = {
1313
}
1414
```
1515

16-
For Webpack 2: use `webpack.LoaderOptionsPlugin`:
16+
For Webpack 2 (^2.1.0-beta.25):
1717

1818
``` js
1919
module.exports = {
2020
// ...
21-
plugins: [
22-
new webpack.LoaderOptionsPlugin({
23-
vue: {
24-
// vue-loader options
21+
module: {
22+
rules: [
23+
{
24+
test: /\.vue$/,
25+
loader: 'vue',
26+
options: {
27+
// vue-loader options
28+
}
2529
}
26-
})
27-
]
30+
]
31+
}
2832
}
2933
```
3034

0 commit comments

Comments
 (0)