Refactoring Webpack files to remove prod file. The prod file is now inferred from the NODE_ENV variable.

This commit is contained in:
David Négrier 2021-05-12 11:05:49 +02:00
parent 8c1e01566a
commit f57c01dee8
6 changed files with 70 additions and 103 deletions

View file

@ -3,12 +3,17 @@ const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const mode = process.env.NODE_ENV ?? 'development';
const isProduction = mode === 'production';
const isDevelopment = !isProduction;
module.exports = {
entry: {
'main': './src/index.ts',
'iframe_api': './src/iframe_api.ts'
},
devtool: 'inline-source-map',
mode: mode,
devtool: isDevelopment ? 'inline-source-map' : 'source-map',
devServer: {
contentBase: './dist',
host: '0.0.0.0',