better esbuild

This commit is contained in:
fyears 2022-04-30 11:59:18 +08:00
parent 6db005018d
commit 1b1083d746
3 changed files with 7 additions and 2 deletions

View File

@ -31,11 +31,11 @@ esbuild
"obsidian",
"electron",
"fs",
"crypto",
"tls",
"net",
// ...builtins
],
inject: ["./esbuild.injecthelper.mjs"],
format: "cjs",
watch: !prod,
target: "es2016",
@ -48,6 +48,9 @@ esbuild
"process.env.DEFAULT_DROPBOX_APP_KEY": `"${DEFAULT_DROPBOX_APP_KEY}"`,
"process.env.DEFAULT_ONEDRIVE_CLIENT_ID": `"${DEFAULT_ONEDRIVE_CLIENT_ID}"`,
"process.env.DEFAULT_ONEDRIVE_AUTHORITY": `"${DEFAULT_ONEDRIVE_AUTHORITY}"`,
global: "window",
"process.env.NODE_DEBUG": `undefined`, // ugly fix
"process.env.DEBUG": `undefined`, // ugly fix
},
})
.catch(() => process.exit(1));

2
esbuild.injecthelper.mjs Normal file
View File

@ -0,0 +1,2 @@
export let Buffer = require("buffer").Buffer;
export let process = require("process/browser");

View File

@ -38,7 +38,7 @@
"chai-as-promised": "^7.1.1",
"cross-env": "^7.0.3",
"dotenv": "^10.0.0",
"esbuild": "^0.14.27",
"esbuild": "^0.14.38",
"jsdom": "^19.0.0",
"mocha": "^9.1.3",
"prettier": "^2.4.1",