File tree Expand file tree Collapse file tree 1 file changed +29
-4
lines changed Expand file tree Collapse file tree 1 file changed +29
-4
lines changed Original file line number Diff line number Diff line change 1
1
import ExtractTextPlugin from 'extract-text-webpack-plugin'
2
+ import { join } from 'path'
2
3
3
4
export function extractStyles ( ) {
4
5
return ! this . options . dev && this . options . build . extractCSS
5
6
}
6
7
7
- export function styleLoader ( ext , loader = [ ] ) {
8
+ export function styleLoader ( ext , loaders = [ ] ) {
9
+ // https://github.com/webpack-contrib/css-loader
10
+ const cssLoader = {
11
+ loader : 'css-loader' ,
12
+ options : {
13
+ minimize : true ,
14
+ sourceMap : true ,
15
+ // https://github.com/webpack/loader-utils#root-relative-urls
16
+ root : '~' ,
17
+ alias : {
18
+ '/static' : join ( this . options . srcDir , 'static' ) ,
19
+ '/assets' : join ( this . options . srcDir , 'assets' )
20
+ }
21
+ }
22
+ }
23
+
24
+ // https://github.com/vuejs/vue-style-loader
25
+ const vueStyleLoader = {
26
+ loader : 'vue-style-loader' ,
27
+ options : {
28
+ sourceMap : true
29
+ }
30
+ }
31
+
8
32
if ( extractStyles . call ( this ) ) {
9
33
return ExtractTextPlugin . extract ( {
10
- use : [ 'css-loader?minify&sourceMap' ] . concat ( loader ) ,
11
- fallback : 'vue-style-loader?sourceMap'
34
+ use : [ cssLoader ] . concat ( loaders ) ,
35
+ fallback : vueStyleLoader
12
36
} )
13
37
}
14
- return [ 'vue-style-loader?sourceMap' , 'css-loader?sourceMap' ] . concat ( loader )
38
+
39
+ return [ vueStyleLoader , cssLoader ] . concat ( loaders )
15
40
}
You can’t perform that action at this time.
0 commit comments