forked from duckdb-wasm-examples/react-typescript-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
70 lines (68 loc) · 1.59 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import HtmlWebpackPlugin from "html-webpack-plugin";
import { fileURLToPath } from "url";
import path from "path";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default {
target: "web",
mode: "production",
entry: {
app: ["./src/app.tsx"],
},
output: {
path: path.resolve(__dirname, "./build/"),
filename: "static/js/[name].[contenthash].js",
chunkFilename: "static/js/[name].[contenthash].js",
assetModuleFilename: "static/assets/[name].[contenthash][ext]",
webassemblyModuleFilename: "static/wasm/[hash].wasm",
clean: true,
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".mjs", ".jsx", ".css", ".wasm"],
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader",
exclude: /node_modules/,
},
{
test: /.*\.wasm$/,
type: "asset/resource",
generator: {
filename: "static/wasm/[name].[contenthash][ext]",
},
},
{
test: /\.css$/,
use: [
'style-loader',
{
loader: "css-loader",
options: {
modules: {
mode: "local",
auto: true,
exportGlobals: true,
localIdentContext: path.resolve(__dirname, "src"),
},
},
},
],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: "./static/index.html",
filename: "./index.html",
}),
],
experiments: {
asyncWebAssembly: true,
},
devtool: false,
performance: {
hints: false,
},
};