Skip to content
Snippets Groups Projects
Commit 3d5debc5 authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

use different method for detecting production build

parent bfdcc1a5
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,10 @@ interface Configuration extends WebpackConfiguration {
devServer?: WebpackDevServerConfiguration;
}
const isProduction = process.argv[process.argv.indexOf('--mode') + 1] === 'production';
console.log(isProduction ? 'Production build' : 'Development build')
const config: Configuration = {
entry: "./src/index.tsx",
module: {
......@@ -31,7 +35,7 @@ const config: Configuration = {
test: /\.scss$/,
exclude: /node_modules/,
use: [
process.env.NODE_ENV !== "production" ? "style-loader" : MiniCssExtractPlugin.loader,
isProduction ? MiniCssExtractPlugin.loader : "style-loader",
"css-loader",
"sass-loader",
],
......@@ -39,7 +43,7 @@ const config: Configuration = {
{
test: /\.css$/,
use: [
process.env.NODE_ENV !== "production" ? "style-loader" : MiniCssExtractPlugin.loader,
isProduction ? MiniCssExtractPlugin.loader : "style-loader",
"css-loader"
],
},
......@@ -78,7 +82,7 @@ const config: Configuration = {
"/authorize": "http://127.0.0.1:5000",
},
},
devtool: process.env.NODE_ENV === "production" ? undefined : "inline-source-map",
devtool: isProduction ? undefined : "inline-source-map",
plugins: [
new ForkTsCheckerWebpackPlugin({
async: false,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment