File tree Expand file tree Collapse file tree 3 files changed +42
-29
lines changed Expand file tree Collapse file tree 3 files changed +42
-29
lines changed Original file line number Diff line number Diff line change @@ -30,22 +30,26 @@ module.exports = {
30
30
}
31
31
```
32
32
33
- Webpack 2.x:
33
+ Webpack 2.x (^2.1.0-beta.25) :
34
34
35
35
``` js
36
- var webpack = require (' webpack' )
37
-
38
36
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
+ }
45
49
}
46
50
}
47
- })
48
- ]
51
+ ]
52
+ }
49
53
}
50
54
```
51
55
Original file line number Diff line number Diff line change @@ -35,30 +35,35 @@ module.exports = {
35
35
}
36
36
```
37
37
38
- ### Webpack 2.x
38
+ ### Webpack 2.x (^2.1.0-beta.25)
39
39
40
40
``` bash
41
41
npm install
[email protected] --save-dev
42
42
```
43
43
44
44
``` js
45
45
// webpack.config.js
46
- var webpack = require (' webpack' )
47
46
var ExtractTextPlugin = require (" extract-text-webpack-plugin" )
48
47
49
48
module .exports = {
50
49
// 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
+ }
59
62
}
60
63
}
61
- }),
64
+ ]
65
+ },
66
+ plugins: [
62
67
new ExtractTextPlugin (" style.css" )
63
68
]
64
69
}
Original file line number Diff line number Diff line change @@ -13,18 +13,22 @@ module.exports = {
13
13
}
14
14
```
15
15
16
- For Webpack 2: use ` webpack.LoaderOptionsPlugin ` :
16
+ For Webpack 2 (^2.1.0-beta.25) :
17
17
18
18
``` js
19
19
module .exports = {
20
20
// ...
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
+ }
25
29
}
26
- })
27
- ]
30
+ ]
31
+ }
28
32
}
29
33
```
30
34
You can’t perform that action at this time.
0 commit comments