-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
78 lines (75 loc) · 2.02 KB
/
webpack.config.js
File metadata and controls
78 lines (75 loc) · 2.02 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const path = require("path");
const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const copyPatterns = [
// This is important for dynamic import! The default `initSdk` expects
// this file to be accessible via fetch:
{
from: "./node_modules/@namada/sdk/dist/sdk.namada.wasm",
to: "./sdk.namada.wasm",
},
];
module.exports = {
target: "web",
mode: "development",
entry: path.join(__dirname, "src", "index.ts"),
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader",
exclude: /node_modules/,
options: {
configFile: path.join(__dirname, "tsconfig.json"),
},
},
{
test: /\.m?js/, // fix:issue: https://github.com/webpack/webpack/issues/11467
resolve: {
fullySpecified: false,
},
},
],
},
resolve: {
extensions: [".ts", ".js"],
modules: [path.join(__dirname, "src/"), "node_modules"],
fallback: {
buffer: require.resolve("buffer"),
},
},
devServer: {
static: [path.join(__dirname, "public")],
compress: true,
port: 9000,
// Only required for multicore build, to support multicore worker helpers
headers: {
"Cross-Origin-Embedder-Policy": "require-corp",
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Resource-Policy": "same-site",
"Cross-Origin-Resource-Policy": "cross-origin",
},
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, "./public/index.html"),
}),
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
}),
new webpack.DefinePlugin({
process: {
env: {},
},
}),
new CopyPlugin({
patterns: copyPatterns,
}),
],
// If using multicore SDK, enable the following:
// stats: {
// // We want to ignore wasm-bindgen-rayon circular dependency warning
// warningsFilter: [/dependency between chunks.+wasm-bindgen-rayon/],
// },
};