-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
51 lines (42 loc) · 940 Bytes
/
webpack.config.js
File metadata and controls
51 lines (42 loc) · 940 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const { NODE_ENV } = process.env;
const path = require("path");
const PRODUCTION = "production";
const DEVELOPMENT = "development";
const isProduction = NODE_ENV === PRODUCTION;
const srcDir = path.resolve(__dirname, "src");
const rootDir = path.resolve(__dirname);
module.exports = {
mode: isProduction ? PRODUCTION : DEVELOPMENT,
entry: {
index: "./src/index.ts",
hooks: "./src/hooks.tsx",
},
output: {
path: rootDir,
filename: "[name].js",
library: "eggs-benedict",
libraryTarget: "umd",
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
use: "ts-loader",
include: srcDir,
},
],
},
resolve: {
extensions: [".tsx", ".ts"],
},
devtool: isProduction ? "source-map" : "inline-source-map",
target: "web",
externals: {
react: {
root: "React",
commonjs: "react",
commonjs2: "react",
},
},
watch: !isProduction,
};