File tree 3 files changed +12
-2
lines changed
3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change
1
+ var config = require ( '../config' )
2
+ if ( ! process . env . NODE_ENV ) process . env . NODE_ENV = config . dev . env
1
3
var path = require ( 'path' )
2
4
var express = require ( 'express' )
3
5
var webpack = require ( 'webpack' )
4
- var config = require ( '../config' )
5
6
var opn = require ( 'opn' )
6
7
var proxyMiddleware = require ( 'http-proxy-middleware' )
7
8
var webpackConfig = { { #if_or unit e2e} } process . env . NODE_ENV = = = 'testing'
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ exports.cssLoaders = function (options) {
25
25
return loader + ( options . sourceMap ? extraParamChar + 'sourceMap' : '' )
26
26
} ) . join ( '!' )
27
27
28
+ // Extract CSS when that option is specified
29
+ // (which is the case during production build)
28
30
if ( options . extract ) {
29
31
return ExtractTextPlugin . extract ( 'vue-style-loader' , sourceLoader )
30
32
} else {
Original file line number Diff line number Diff line change @@ -3,6 +3,13 @@ var config = require('../config')
3
3
var utils = require ( './utils' )
4
4
var projectRoot = path . resolve ( __dirname , '../' )
5
5
6
+ var env = process . env . NODE_ENV
7
+ // check env & config/index.js to decide weither to enable CSS Sourcemaps for the
8
+ // various preprocessor loaders added to vue-loader at the end of this file
9
+ var cssSourceMapDev = ( env === 'development' && config . dev . cssSourceMap )
10
+ var cssSourceMapProd = ( env === 'production' && config . build . productionSourceMap )
11
+ var useCssSourceMap = cssSourceMapDev || cssSourceMapProd
12
+
6
13
module . exports = {
7
14
entry : {
8
15
app : './src/main.js'
@@ -83,7 +90,7 @@ module.exports = {
83
90
} ,
84
91
{ { / lint } }
85
92
vue : {
86
- loaders : utils . cssLoaders ( ) ,
93
+ loaders : utils . cssLoaders ( { sourceMap : useCssSourceMap } ) ,
87
94
postcss : [
88
95
require ( 'autoprefixer' ) ( {
89
96
browsers : [ 'last 2 versions' ]
You can’t perform that action at this time.
0 commit comments