File tree 2 files changed +27
-2
lines changed
2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+
3
+ // webpack.config.prod.js checks this.
4
+ process . env . NODE_ENV = 'production' ;
5
+
6
+ // Load the create-react-app config.
7
+ const webpackConfigProd = require ( 'react-scripts/config/webpack.config.prod' ) ;
8
+
9
+ // Modify the config according to our needs.
10
+
11
+ const babelLoader = webpackConfigProd . module . loaders [ 0 ] ;
12
+ if ( babelLoader . loader !== 'babel' ) {
13
+ console . error ( webpackConfigProd . module . loaders ) ;
14
+ throw new Error ( 'Couldn\'t find the babel loader config.' ) ;
15
+ }
16
+
17
+ babelLoader . query . plugins = ( babelLoader . query . plugins || [ ] )
18
+ . filter ( pluginName => pluginName !== 'lodash' )
19
+ . concat ( 'lodash' ) ;
20
+
21
+ console . log ( 'Added lodash babel plugin to build' ) ;
22
+
23
+ // Run the build.
24
+ require ( 'react-scripts/scripts/build' ) ;
Original file line number Diff line number Diff line change 4
4
"private" : true ,
5
5
"devDependencies" : {
6
6
"babel-eslint" : " ^7.1.0" ,
7
+ "babel-plugin-lodash" : " ^3.2.9" ,
7
8
"deep-freeze" : " 0.0.1" ,
8
9
"eslint" : " ^3.9.1" ,
9
10
"eslint-plugin-react" : " ^6.6.0" ,
33
34
},
34
35
"scripts" : {
35
36
"start" : " react-scripts start" ,
36
- "build" : " npm run lint && react-scripts build" ,
37
+ "build" : " npm run lint && node bin/ build.js " ,
37
38
"test" : " npm run lint && react-scripts test --env=jsdom" ,
38
39
"eject" : " react-scripts eject" ,
39
- "lint" : " eslint --ext js,jsx .eslintrc.js src/" ,
40
+ "lint" : " eslint --ext js,jsx .eslintrc.js src/ bin/ " ,
40
41
"deploy" : " npm run build && surge -p ./build -d wpconsole.surge.sh"
41
42
}
42
43
}
You can’t perform that action at this time.
0 commit comments