Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
set webpack mode based NODE_ENV environment variable
  • Loading branch information
kajan committed Feb 18, 2021
1 parent 625093f commit df440b3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions AspNetCoreVueMpa.Web/ClientApp/webpack.config.js
Expand Up @@ -4,6 +4,13 @@ const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');

const isProduction = (process.env.NODE_ENV === 'production');
if (isProduction) {
console.log("Bundling in PRODUCTION mode")
} else {
console.log("Bundling in DEVELOPMENT mode")
}

const entries = {};
entries['styles'] = path.join(__dirname, 'assets/styles/styles.scss');

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

module.exports = {
entry: entries,
mode: isProduction ? 'production' : 'development',
output: {
path: path.resolve(__dirname, '../wwwroot'),
filename: 'js/[name].bundle.js'
Expand Down

0 comments on commit df440b3

Please sign in to comment.