-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
44 lines (40 loc) · 1017 Bytes
/
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
42
43
44
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const WebpackShellPlugin = require('webpack-shell-plugin-next');
const isProd = process.env.NODE_ENV === 'production';
const env = process.env.NODE_ENV;
module.exports = {
mode: env,
entry: './src/main.ts',
output: {
path: path.resolve(__dirname, 'dist'),
// filename: isProd ? '[name].[contenthash].js' : 'main.js',
filename: 'main.js',
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
devtool: 'inline-source-map',
target: 'node',
// Reload on file changes
watch: !isProd,
// Exclude deps from bundle, expects deps to be present in environment
externals: [nodeExternals()],
plugins: [
new WebpackShellPlugin({
onBuildEnd: {
scripts: isProd ? [] : ['npm run start:dev', 'npm run mongo:dev'],
blocking: false,
parallel: true,
},
}),
],
};