fallback in web

This commit is contained in:
fyears 2021-10-20 02:11:02 +08:00
parent 09a8cfdccb
commit b9613918e5

View File

@ -2,7 +2,7 @@ const path = require("path");
module.exports = {
entry: "./main.ts",
target: "node",
target: "web",
output: {
filename: "main.js",
path: __dirname,
@ -20,6 +20,31 @@ module.exports = {
resolve: {
extensions: [".tsx", ".ts", ".js"],
mainFields: ["module", "main"],
fallback: {
assert: require.resolve("assert"),
buffer: require.resolve("buffer/"),
console: require.resolve("console-browserify"),
constants: require.resolve("constants-browserify"),
crypto: require.resolve("crypto-browserify"),
domain: require.resolve("domain-browser"),
events: require.resolve("events"),
http: require.resolve("stream-http"),
https: require.resolve("https-browserify"),
os: require.resolve("os-browserify/browser"),
path: require.resolve("path-browserify"),
punycode: require.resolve("punycode"),
process: require.resolve("process/browser"),
querystring: require.resolve("querystring-es3"),
stream: require.resolve("stream-browserify"),
string_decoder: require.resolve("string_decoder"),
sys: require.resolve("util"),
timers: require.resolve("timers-browserify"),
tty: require.resolve("tty-browserify"),
url: require.resolve("url"),
util: require.resolve("util"),
vm: require.resolve("vm-browserify"),
zlib: require.resolve("browserify-zlib"),
}
},
externals: {
obsidian: "commonjs2 obsidian",