diff options
Diffstat (limited to 'webpack.config.base.js')
-rw-r--r-- | webpack.config.base.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/webpack.config.base.js b/webpack.config.base.js new file mode 100644 index 000000000..5f81713ce --- /dev/null +++ b/webpack.config.base.js | |||
@@ -0,0 +1,24 @@ | |||
1 | const path = require('path'); | ||
2 | const TerserPlugin = require('terser-webpack-plugin'); | ||
3 | |||
4 | const IS_DEV = process.env.NODE_ENV === 'development'; | ||
5 | |||
6 | module.exports = dir => ({ | ||
7 | context: dir, | ||
8 | entry: path.join(dir, '/src/index.ts'), | ||
9 | module: { | ||
10 | rules: [{ | ||
11 | test: /\.tsx?$/, | ||
12 | loader: 'ts-loader', | ||
13 | exclude: /node_modules/, | ||
14 | }], | ||
15 | }, | ||
16 | resolve: { | ||
17 | extensions: ['.tsx', '.ts', '.js'], | ||
18 | }, | ||
19 | devtool: 'inline-source-map', | ||
20 | mode: IS_DEV ? 'development' : 'production', | ||
21 | optimization: { | ||
22 | minimizer: !IS_DEV ? [new TerserPlugin()] : [], | ||
23 | }, | ||
24 | }); | ||