mirror of
https://github.com/MercuryWorkshop/adrift.git
synced 2025-05-12 05:50:00 -04:00
31 lines
No EOL
811 B
JavaScript
31 lines
No EOL
811 B
JavaScript
let makeAllPackagesExternalPlugin = {
|
|
name: 'make-all-packages-external',
|
|
setup(build) {
|
|
let filter = /^[^.\/]|^\.[^.\/]|^\.\.[^\/]/ // Must not start with "/" or "./" or "../"
|
|
let ignored = ["wrtc"]
|
|
build.onResolve({ filter }, args => (ignored.includes(args.path) ? { path: args.path, external: true } : null))
|
|
},
|
|
}
|
|
const { build } = require('esbuild');
|
|
build({
|
|
entryPoints: ["src/main.ts"],
|
|
platform: "node",
|
|
// format: "esm",
|
|
bundle: true,
|
|
minify: true,
|
|
|
|
outfile: "dist/main.js",
|
|
plugins: [
|
|
makeAllPackagesExternalPlugin
|
|
],
|
|
})
|
|
build({
|
|
entryPoints: ["src/autoupdater.ts"],
|
|
platform: "node",
|
|
bundle: true,
|
|
minify: true,
|
|
outfile: "dist/autoupdater.js",
|
|
plugins: [
|
|
makeAllPackagesExternalPlugin
|
|
],
|
|
}) |