forked from serverless-dns/serverless-dns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.cjs
46 lines (40 loc) · 998 Bytes
/
webpack.config.cjs
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
const webpack = require("webpack");
// developers.cloudflare.com/workers/cli-wrangler/configuration#modules
// archive.is/FDky9
module.exports = {
entry: "./src/server-workers.js",
target: ["webworker", "es2020"],
mode: "production",
// enable devtool in development
// devtool: 'eval-cheap-module-source-map',
resolve: {
fallback: {
// buffer polyfill: archive.is/7OBM7
buffer: require.resolve('buffer/'),
},
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
new webpack.IgnorePlugin({
resourceRegExp:
/(^dgram$)|(^http2$)|(\/deno\/.*\.ts$)|(.*-deno\.ts$)|(.*\.deno\.ts$)|(\/node\/.*\.js$)|(.*-node\.js$)|(.*\.node\.js$)/,
}),
],
optimization: {
usedExports: true,
minimize: true,
},
experiments: {
outputModule: true,
},
// stackoverflow.com/a/68916455
output: {
library: {
type: "module",
},
filename: "worker.js",
module: true,
},
};