Skip to content

Commit df440b3

Browse files
author
kajan
committed
set webpack mode based NODE_ENV environment variable
1 parent 625093f commit df440b3

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎AspNetCoreVueMpa.Web/ClientApp/webpack.config.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ const path = require('path');
44
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
55
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
66

7+
const isProduction = (process.env.NODE_ENV === 'production');
8+
if (isProduction) {
9+
console.log("Bundling in PRODUCTION mode")
10+
} else {
11+
console.log("Bundling in DEVELOPMENT mode")
12+
}
13+
714
const entries = {};
815
entries['styles'] = path.join(__dirname, 'assets/styles/styles.scss');
916

@@ -23,6 +30,7 @@ glob.sync('./views/**/main.js').forEach(path => {
2330

2431
module.exports = {
2532
entry: entries,
33+
mode: isProduction ? 'production' : 'development',
2634
output: {
2735
path: path.resolve(__dirname, '../wwwroot'),
2836
filename: 'js/[name].bundle.js'

0 commit comments

Comments
 (0)