File tree Expand file tree Collapse file tree 4 files changed +8
-10
lines changed Expand file tree Collapse file tree 4 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ var CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
25
25
var normalize = require ( '../utils/path' ) . normalize ;
26
26
27
27
var Config = function ( ) {
28
- function Config ( cwd , configFile ) {
28
+ function Config ( cwd , configFile , env ) {
29
29
( 0 , _classCallCheck3 . default ) ( this , Config ) ;
30
30
31
31
var dir = normalize ( cwd ) . split ( '/' ) ;
@@ -72,7 +72,7 @@ var Config = function () {
72
72
loader : require . resolve ( 'html-loader' )
73
73
} , {
74
74
test : / \. c s s $ / ,
75
- loader : ExtractTextPlugin . extract ( require . resolve ( 'style-loader' ) , require . resolve ( 'css-loader' ) )
75
+ loader : env === 'local' ? 'style!css' : ExtractTextPlugin . extract ( require . resolve ( 'style-loader' ) , require . resolve ( 'css-loader' ) )
76
76
} ] ,
77
77
postLoaders : [ ]
78
78
} ,
Original file line number Diff line number Diff line change @@ -56,9 +56,8 @@ var Project = function () {
56
56
57
57
this . cwd = cwd ;
58
58
this . configFile = globby . sync ( [ 'ykit.*.js' , 'ykit.js' ] , { cwd : cwd } ) [ 0 ] || '' ;
59
-
60
59
this . plugins = [ ] ;
61
- this . config = new Config ( cwd , this . configFile ) ;
60
+ this . config = new Config ( cwd , this . configFile , this . _getCurrentEnv ( ) ) ;
62
61
this . commands = Manager . getCommands ( ) ;
63
62
this . middlewares = [ ] ;
64
63
this . beforePackCallbacks = [ ] ;
@@ -408,7 +407,7 @@ var Project = function () {
408
407
var isExtractTextPluginExists = config . plugins . some ( function ( plugin ) {
409
408
return plugin instanceof ExtractTextPlugin ;
410
409
} ) ;
411
- if ( ! isExtractTextPluginExists ) {
410
+ if ( ! isExtractTextPluginExists && this . _getCurrentEnv ( ) !== 'local' ) {
412
411
config . plugins . push ( new ExtractTextPlugin ( config . output . filename . replace ( '[ext]' , '.css' ) ) ) ;
413
412
}
414
413
}
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
6
6
const normalize = require ( '../utils/path' ) . normalize ;
7
7
8
8
class Config {
9
- constructor ( cwd , configFile ) {
9
+ constructor ( cwd , configFile , env ) {
10
10
const dir = normalize ( cwd ) . split ( '/' ) ;
11
11
const projectDir = dir [ dir . length - 1 ] ;
12
12
@@ -51,7 +51,7 @@ class Config {
51
51
loader : require . resolve ( 'html-loader' )
52
52
} , {
53
53
test : / \. c s s $ / ,
54
- loader : ExtractTextPlugin . extract (
54
+ loader : env === 'local' ? 'style!css' : ExtractTextPlugin . extract (
55
55
require . resolve ( 'style-loader' ) ,
56
56
require . resolve ( 'css-loader' )
57
57
)
Original file line number Diff line number Diff line change @@ -24,9 +24,8 @@ class Project {
24
24
constructor ( cwd ) {
25
25
this . cwd = cwd ;
26
26
this . configFile = globby . sync ( [ 'ykit.*.js' , 'ykit.js' ] , { cwd : cwd } ) [ 0 ] || '' ;
27
-
28
27
this . plugins = [ ] ;
29
- this . config = new Config ( cwd , this . configFile ) ;
28
+ this . config = new Config ( cwd , this . configFile , this . _getCurrentEnv ( ) ) ;
30
29
this . commands = Manager . getCommands ( ) ;
31
30
this . middlewares = [ ] ;
32
31
this . beforePackCallbacks = [ ] ;
@@ -390,7 +389,7 @@ class Project {
390
389
const isExtractTextPluginExists = config . plugins . some ( ( plugin ) => {
391
390
return plugin instanceof ExtractTextPlugin ;
392
391
} ) ;
393
- if ( ! isExtractTextPluginExists ) {
392
+ if ( ! isExtractTextPluginExists && this . _getCurrentEnv ( ) !== 'local' ) {
394
393
config . plugins . push ( new ExtractTextPlugin ( config . output . filename . replace ( '[ext]' , '.css' ) ) ) ;
395
394
}
396
395
}
You can’t perform that action at this time.
0 commit comments