Skip to content

Commit

Permalink
Merge pull request #123 from Neddz/master
Browse files Browse the repository at this point in the history
Fix how NODE_ENV is being handled
  • Loading branch information
swyxio authored Feb 14, 2019
2 parents 5449ef1 + 5fb6819 commit 0121b5f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,14 @@ function webpackConfig(dir, additionalConfig) {
defineEnv['process.env.' + key] = JSON.stringify(envConfig[key]);
});

// Keep the same NODE_ENV if it was specified
var nodeEnv = process.env.NODE_ENV || 'production'

// Set webpack mode based on the nodeEnv
var webpackMode = ['production', 'development'].includes(nodeEnv) ? nodeEnv : 'none'

var webpackConfig = {
mode: 'production',
mode: webpackMode,
resolve: {
extensions: ['.wasm', '.mjs', '.js', '.json', '.ts']
},
Expand Down Expand Up @@ -99,6 +105,9 @@ function webpackConfig(dir, additionalConfig) {
filename: '[name].js',
libraryTarget: 'commonjs'
},
optimization: {
nodeEnv
},
devtool: false
};
fs.readdirSync(dirPath).forEach(function(file) {
Expand Down

0 comments on commit 0121b5f

Please sign in to comment.