-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
61 lines (59 loc) · 1.5 KB
/
webpack.config.js
File metadata and controls
61 lines (59 loc) · 1.5 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
import path from "path";
import { fileURLToPath } from "url";
import { createRequire } from "module";
import webpack from "webpack"
const require = createRequire(import.meta.url);
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default {
entry: "./src/index.js",
mode: "production",
optimization: {
minimize: true,
},
performance: {
hints: false,
},
output: {
path: __dirname + "/dist",
publicPath: "dist",
filename: "index.mjs",
library: {
type: "module",
},
},
experiments: {
outputModule: true,
},
module: {
rules: [
// all files with a `.ts`, `.cts`, `.mts` or `.tsx` extension will be handled by `ts-loader`
{ test: /\.([cm]?ts|tsx)$/, loader: "ts-loader" },
],
},
resolve: {
fallback: {
path: false,
stream: false,
crypto: require.resolve("crypto-browserify"),
// os: require.resolve("os-browserify/browser"),
// zlib: require.resolve("browserify-zlib"),
util: false,
dns: false,
// http: require.resolve("stream-http"),
// https: require.resolve("https-browserify"),
http: false,
https: false,
buffer: require.resolve("buffer/"),
vm: require.resolve("vm-browserify"),
url: require.resolve("url/"),
// http: require.resolve("stream-http"),
// assert: require.resolve("assert/"),
},
},
plugins: [
new webpack.ProvidePlugin({
process: "process/browser.js",
}),
],
};