-
Notifications
You must be signed in to change notification settings - Fork 117
/
webpack.config.js
41 lines (38 loc) · 1 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const webpack = require('webpack');
const path = require('path');
const argv = require('yargs').argv;
const config = {
entry: '/src/software/api/react-loader.jsx',
devtool: 'source-map',
mode: 'development',
optimization: {
minimize: false
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'software/api/runner-bundle.js'
},
resolve: {
extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [ '@babel/preset-react', '@babel/preset-env' ]
}
}
}
]
}
};
if (argv?.prod || process.env.NODE_ENV === 'production') {
config.optimization.minimize = true;
config.mode = 'production';
delete config.devtool;
}
module.exports = config;