-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathwebpack.config.js
39 lines (39 loc) · 929 Bytes
/
webpack.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
/** @typedef {import("webpack").Configuration} Configuration */
/** @typedef {{ entryFile: string, externals: string[], libraryName: string, outDir: string }} LibraryConfiguration */
/** @type {(config: LibraryConfiguration) => Configuration} */
module.exports = ({ entryFile, externals, libraryName, outDir }) => ({
devtool: "source-map",
entry: entryFile,
externals,
mode: "production",
module: {
rules: [
{
exclude: /node_modules/,
test: /\.tsx?$/,
use: [
{
loader: "ts-loader",
options: {
configFile: "tsconfig.build.json",
},
},
],
},
],
},
output: {
library: {
name: libraryName,
type: "umd",
},
filename: "index.js",
globalObject: "this",
path: outDir,
},
resolve: {
extensions: [".tsx", ".ts"],
},
stats: true,
target: ["web", "es5"],
});