-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.dev.ts
58 lines (56 loc) · 1.33 KB
/
webpack.config.dev.ts
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import path from 'path';
import nodeExternals from 'webpack-node-externals';
import {Configuration} from 'webpack';
import WebpackShellPluginNext from 'webpack-shell-plugin-next';
const getConfig = (env: {WEBPACK_WATCH: boolean}): Configuration => {
const isInWatchingMode = env.WEBPACK_WATCH === true;
return {
entry: './src/main.ts',
target: 'node',
mode: 'development',
externals: [nodeExternals()],
plugins: [
new WebpackShellPluginNext({
onBuildStart: {
scripts: ['npm run clean:dev'],
blocking: true,
parallel: false,
},
onBuildEnd: isInWatchingMode
? {
scripts: ['npm run watch:build'],
blocking: false,
parallel: true,
}
: {},
}),
],
module: {
rules: [
{
test: /\.(ts|js)$/,
loader: 'ts-loader',
options: {},
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.ts', '.js'],
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
output: {
path: path.join(__dirname, 'build'),
filename: 'main.js',
},
optimization: {
moduleIds: 'deterministic',
splitChunks: {
chunks: 'all',
},
},
};
};
export default getConfig;