-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
117 lines (108 loc) · 2.86 KB
/
webpack.config.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import type { Configuration } from "webpack";
const GasPlugin = require("gas-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const commonConfig: Configuration = {
context: __dirname,
mode: "none",
output: {
clean: true,
filename: "Code.js"
},
resolve: { extensions: [".ts"] }
};
const copyPlugin = new CopyWebpackPlugin({
patterns: [
{ from: "./config/appsscript.json", to: "./" },
{ from: "./src/index.html", to: "./" }
]
});
const es2022Global: Configuration = {
...commonConfig,
entry: "./src/es2022-global/main.ts",
name: "es2022Global",
module: { rules: [{ test: /(\.ts)$/, loader: "ts-loader" }] },
output: {
...commonConfig.output,
path: `${__dirname}/dist/es2022-global`
},
plugins: [
new GasPlugin(),
copyPlugin
]
};
const es2022AutoGlobal: Configuration = {
...commonConfig,
entry: "./src/es2022-autoGlobal/main.ts",
name: "es2022AutoGlobal",
module: { rules: [{ test: /(\.ts)$/, loader: "ts-loader" }] },
output: {
...commonConfig.output,
path: `${__dirname}/dist/es2022-autoGlobal`
},
plugins: [
new GasPlugin({
autoGlobalExportsFiles: ["./src/es2022-autoGlobal/main.ts"]
}),
copyPlugin
]
};
const es2022AutoGlobalDeclarationExport: Configuration = {
...commonConfig,
entry: "./src/es2022-autoGlobal-declarationExport/main.ts",
name: "es2022AutoGlobalDeclarationExport",
module: { rules: [{ test: /(\.ts)$/, loader: "ts-loader" }] },
output: {
...commonConfig.output,
path: `${__dirname}/dist/es2022-autoGlobal-declarationExport`
},
plugins: [
new GasPlugin({
autoGlobalExportsFiles: ["./src/es2022-autoGlobal-declarationExport/main.ts"]
}),
copyPlugin
]
};
const es2022AutoGlobalListExport: Configuration = {
...commonConfig,
entry: "./src/es2022-autoGlobal-listExport/main.ts",
name: "es2022AutoGlobalListExport",
module: { rules: [{ test: /(\.ts)$/, loader: "ts-loader" }] },
output: {
...commonConfig.output,
path: `${__dirname}/dist/es2022-autoGlobal-listExport`
},
plugins: [
new GasPlugin({
autoGlobalExportsFiles: ["./src/es2022-autoGlobal-listExport/main.ts"]
}),
copyPlugin
]
};
const commonJsAutoGlobal: Configuration = {
...commonConfig,
entry: "./src/commonjs-autoGlobal/main.ts",
name: "commonJsAutoGlobal",
module: {
rules: [{
test: /(\.ts)$/, use: [
{
loader: "ts-loader",
options: {
configFile: 'tsconfig.cjs.json'
}
}
]
}]
},
output: {
...commonConfig.output,
path: `${__dirname}/dist/commonjs-autoGlobal`
},
plugins: [
new GasPlugin({
autoGlobalExportsFiles: ["./src/commonjs-autoGlobal/main.ts"]
}),
copyPlugin
]
};
export default [es2022Global, es2022AutoGlobal, commonJsAutoGlobal, es2022AutoGlobalDeclarationExport, es2022AutoGlobalListExport];