File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -17,14 +17,9 @@ const webpack = require('webpack');
17
17
* @return {void }
18
18
*/
19
19
module . exports = function ( plugins , webpackConfig ) {
20
-
21
- if ( ! webpackConfig . isProduction ( ) ) {
22
- return ;
23
- }
24
-
25
20
const definePluginOptions = {
26
21
'process.env' : {
27
- NODE_ENV : '"production"'
22
+ NODE_ENV : webpackConfig . isProduction ( ) ? '"production"' : '"development "'
28
23
}
29
24
} ;
30
25
Original file line number Diff line number Diff line change @@ -30,7 +30,9 @@ describe('plugins/define', () => {
30
30
const plugins = [ ] ;
31
31
32
32
definePluginUtil ( plugins , config ) ;
33
- expect ( plugins . length ) . to . equal ( 0 ) ;
33
+ expect ( plugins . length ) . to . equal ( 1 ) ;
34
+ expect ( plugins [ 0 ] ) . to . be . instanceof ( webpack . DefinePlugin ) ;
35
+ expect ( plugins [ 0 ] . definitions [ 'process.env' ] . NODE_ENV ) . to . equal ( JSON . stringify ( 'development' ) ) ;
34
36
} ) ;
35
37
36
38
it ( 'production environment with default settings' , ( ) => {
@@ -40,6 +42,7 @@ describe('plugins/define', () => {
40
42
definePluginUtil ( plugins , config ) ;
41
43
expect ( plugins . length ) . to . equal ( 1 ) ;
42
44
expect ( plugins [ 0 ] ) . to . be . instanceof ( webpack . DefinePlugin ) ;
45
+ expect ( plugins [ 0 ] . definitions [ 'process.env' ] . NODE_ENV ) . to . equal ( JSON . stringify ( 'production' ) ) ;
43
46
} ) ;
44
47
45
48
it ( 'production environment with options callback' , ( ) => {
You can’t perform that action at this time.
0 commit comments