This repository was archived by the owner on Aug 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.ts
More file actions
51 lines (48 loc) · 1.36 KB
/
Copy pathwebpack.config.ts
File metadata and controls
51 lines (48 loc) · 1.36 KB
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
import HtmlWebpackPlugin from "html-webpack-plugin";
import { Configuration } from "webpack";
import CopyPlugin from "copy-webpack-plugin";
const isProd = process.env.NODE_ENV === "production";
const config: Configuration = {
mode: isProd ? "production" : "development",
entry: "./src/ui/index.tsx",
output: {
filename: "[name].[contenthash:8].js",
},
resolve: {
extensions: [".js", ".ts", ".tsx"],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
],
},
externals: {
"pdfkit": "PDFDocument",
"blob-stream": "blobStream",
},
plugins: [
new HtmlWebpackPlugin({
template: "public/index.html",
}),
new CopyPlugin({
patterns: [
{ from: "public", globOptions: { ignore: ["**/index.html"] } },
{ from: "node_modules/pdfkit/js/pdfkit.standalone.js" },
{ from: "node_modules/blob-stream/.js", to: "blob-stream.js" },
],
}),
],
performance: {
maxAssetSize: 2048 * 1024,
maxEntrypointSize: 512 * 1024,
},
devtool: isProd ? false : "eval-source-map",
};
export default config;