-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
60 lines (57 loc) · 1.33 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import TerserPlugin from "terser-webpack-plugin";
import ResolveTypeScriptPlugin from "resolve-typescript-plugin";
import * as core from "flow-connect/core";
import * as ui from "flow-connect/ui";
import * as common from "flow-connect/common";
import * as utils from "flow-connect/utils";
import * as flowConnect from "flow-connect";
const externalPackages = {
"flow-connect/core": core,
"flow-connect/common": common,
"flow-connect/ui": ui,
"flow-connect/utils": utils,
"flow-connect": flowConnect,
};
export default {
mode: "production",
devtool: "source-map",
performance: {
hints: false,
maxEntrypointSize: 249856,
maxAssetSize: 249856,
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin()],
},
resolve: {
extensions: [".js"],
plugins: [new ResolveTypeScriptPlugin()],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/,
},
],
},
externals: [
function ({ request }, callback) {
if (/^flow-connect.*/gm.test(request)) {
return callback(
null,
[`{${Object.keys(externalPackages[request]).join(",")}}`],
"root"
);
}
callback();
},
],
output: {
filename: "[name].js",
libraryTarget: "window",
umdNamedDefine: true,
},
};