forked from motiondivision/motion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.size.config.js
78 lines (76 loc) · 2 KB
/
webpack.size.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const tsconfig = require("./tsconfig.json")
const path = require("path")
const convertPathsToAliases = require("convert-tsconfig-paths-to-webpack-aliases")
.default
const TerserPlugin = require("terser-webpack-plugin")
const tsLoader = {
loader: "ts-loader",
options: { transpileOnly: true },
}
module.exports = {
mode: "production",
entry: {
"size-webpack-m": path.join(
__dirname,
"./src/render/dom/motion-minimal.ts"
),
"size-webpack-dom-animation": path.join(
__dirname,
"./src/render/dom/features-animation.ts"
),
"size-webpack-dom-max": path.join(
__dirname,
"./src/render/dom/features-max.ts"
),
},
output: {
path: path.join(__dirname, "dist"),
filename: "[name].js",
},
devtool: false,
optimization: {
usedExports: true,
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
output: { comments: false },
},
}),
],
},
externals: {
react: {
root: "React",
commonjs2: "react",
commonjs: "react",
amd: "react",
},
"react-dom": {
root: "ReactDOM",
commonjs2: "ReactDOM",
commonjs: "ReactDOM",
amd: "ReactDOM",
},
"@emotion/is-prop-valid": {
root: "@emotion/is-prop-valid",
commonjs2: "@emotion/is-prop-valid",
commonjs: "@emotion/is-prop-valid",
amd: "@emotion/is-prop-valid",
},
},
resolve: {
modules: ["node_modules"],
extensions: [".ts", ".tsx", ".js", ".json"],
alias: convertPathsToAliases(tsconfig),
},
module: {
rules: [
{
test: /\.ts(x?)$/,
exclude: [/__tests__/, /node_modules/],
use: [tsLoader],
},
],
},
}