-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.js
More file actions
37 lines (34 loc) · 861 Bytes
/
webpack.config.js
File metadata and controls
37 lines (34 loc) · 861 Bytes
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
const path = require("path");
module.exports = (_, { mode, name }) => {
const isDev = mode === "development";
const isDemo = name === "demo";
const pathRoot = isDemo ? path.resolve(__dirname, "demo") : __dirname;
return {
resolve: {
extensions: [".ts"],
},
entry: [path.resolve(pathRoot, "src/index.ts")],
output: {
path: path.resolve(pathRoot, "dist"),
filename: "index.js",
libraryTarget: isDemo ? undefined : "commonjs2",
clean: true,
},
module: {
rules: [
{
test: /\.ts$/,
use: [
{
loader: "ts-loader",
options: {
configFile: isDemo ? "tsconfig.dev.json" : undefined,
},
},
],
},
],
},
devtool: isDev ? "inline-source-map" : undefined,
};
};