forked from jaensen/circles-dappcon-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
47 lines (42 loc) · 1.14 KB
/
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
40
41
42
43
44
45
46
47
const mode = process.env.NODE_ENV || "development";
const path = require("path");
const { merge } = require("webpack-merge");
const parts = require("./webpack.parts");
const common = merge([
{ output: { path: path.resolve(process.cwd(), "dist") } },
parts.page({ title: "Checkout DappCon ticket with Circles" }),
parts.loadSvg(),
parts.svelte(mode),
parts.extractCSS({ loaders: ["postcss-loader"] }),
parts.useDotenv(),
parts.polyfills(),
parts.static(),
]);
const development = merge([
{ entry: ["./src/index.ts"] },
{ target: "web" },
parts.generateSourceMaps({ type: "eval-source-map" }),
parts.esbuild(),
parts.devServer(),
]);
const production = merge(
[
{ entry: ["./src/index.ts"] },
parts.typescript(),
parts.optimize(),
// parts.analyze()
].filter(Boolean)
);
const getConfig = (mode) => {
return merge(common, development, { mode });
/*
switch (mode) {
case "production":
return merge(common, production, { mode });
case "development":
return merge(common, development, { mode });
default:
throw new Error(`Unknown mode, ${mode}`);
}*/
};
module.exports = getConfig(mode);