feat(webpack): set NODE_ENV on production builds

pull/2670/head
Chaim Lev-Ari 2018-12-12 10:32:55 +02:00
parent 035d71edb2
commit 4148e7140d
1 changed files with 12 additions and 2 deletions

View File

@ -13,7 +13,7 @@ module.exports = function(grunt) {
grunt.registerTask('default', ['eslint', 'build']); grunt.registerTask('default', ['eslint', 'build']);
grunt.registerTask('build-webapp', ['config:prod', 'clean:all', 'copy:templates','webpack:prod']); grunt.registerTask('build-webapp', ['config:prod','env:prod', 'clean:all', 'copy:templates','webpack:prod']);
grunt.registerTask('build', [ grunt.registerTask('build', [
'config:dev', 'config:dev',
@ -36,6 +36,7 @@ module.exports = function(grunt) {
) { ) {
grunt.task.run([ grunt.task.run([
'config:prod', 'config:prod',
'env:prod',
'clean:all', 'clean:all',
'copy:templates', 'copy:templates',
'shell:buildBinary:' + p + ':' + a, 'shell:buildBinary:' + p + ':' + a,
@ -66,12 +67,21 @@ module.exports = function(grunt) {
eslint: gruntfile_cfg.eslint, eslint: gruntfile_cfg.eslint,
shell: gruntfile_cfg.shell, shell: gruntfile_cfg.shell,
copy: gruntfile_cfg.copy, copy: gruntfile_cfg.copy,
webpack: gruntfile_cfg.webpack webpack: gruntfile_cfg.webpack,
env: gruntfile_cfg.env
}); });
}; };
/***/ /***/
gruntfile_cfg.env = {
dev: {
NODE_ENV: 'development'
},
prod: {
NODE_ENV: 'production'
}
}
gruntfile_cfg.webpack = { gruntfile_cfg.webpack = {
dev: webpackDevConfig, dev: webpackDevConfig,