-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
46 lines (43 loc) · 1.08 KB
/
webpack.common.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
45
46
const path = require("path");
const TerserPlugin = require("terser-webpack-plugin");
const PATHS = {
entryPoint: path.resolve(__dirname, "src/index.ts"),
bundles: path.resolve(__dirname, "dist/_bundles"),
};
const config = {
entry: {
"g43-lib": [PATHS.entryPoint],
"g43-lib.min": [PATHS.entryPoint],
},
devtool: "inline-source-map",
mode: "development",
output: {
path: PATHS.bundles,
filename: "[name].js",
libraryTarget: "umd",
library: "G43Lib",
umdNamedDefine: true,
},
resolve: {
extensions: [".ts", ".tsx", ".js"],
},
optimization: {
minimize: true,
minimizer: [
(compiler) => {
new TerserPlugin({
test: /\.min\.js(\?.*)?$/i,
}).apply(compiler);
},
],
},
module: {
rules: [{
test: /\.tsx?$/,
// loader: "awesome-typescript-loader",
loader: "ts-loader",
exclude: /node_modules/,
}],
},
};
module.exports = config;