-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
67 lines (66 loc) · 1.68 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
/* eslint-disable @typescript-eslint/no-require-imports */
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const webpack = require("webpack");
module.exports = ({mode} = {mode: "development"}) => ({
entry: {
"app": "./test/web.mjs",
},
mode,
devtool: "nosources-source-map",
experiments: {
topLevelAwait: true
},
output: {
path: path.join(__dirname, "build"),
filename: "[name].bundle.js",
globalObject: "self",
clean: true,
},
devServer: {
open: true,
hot: true,
},
resolve: {
fallback: {
"./%23ui2%23cl_json.clas.mjs": false,
"crypto": require.resolve("crypto-browserify"),
"path": require.resolve("path-browserify"),
"buffer": require.resolve("buffer/"),
"util/types": false,
"util": require.resolve("web-encoding"),
"zlib": false,
"stream": false,
"process": false,
"http": false,
"url": false,
"fs": false,
"tls": false,
"https": false,
"net": false,
},
extensions: [".mjs", ".js"],
},
module: {
rules: [
]
},
plugins: [
new HtmlWebpackPlugin({
template: "test/index.html",
}),
new CopyPlugin({
patterns: [
{ from: './node_modules/sql.js/dist/sql-wasm.wasm', to: "./" },
{ from: './node_modules/sql.js/dist/sql-wasm-debug.wasm', to: "./" },
{ from: './node_modules/sql.js/dist/sql-wasm-debug.js', to: "./" },
],
}),
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
],
});