Holesail Service Daemon + Bin Client
This commit is contained in:
@@ -18,6 +18,23 @@ import * as esbuild from 'esbuild'
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
const repoRoot = join(__dirname, '..', '..')
|
||||
const booterNodeModules = join(repoRoot, 'packages/bare-os-booter/node_modules')
|
||||
|
||||
/**
|
||||
* esbuild `platform: 'node'` marks builtins external; drive IIFEs run under `new Function`
|
||||
* on Pear with no `globalThis.require`. Map Node core modules to Bare shims so they bundle in.
|
||||
* Use package names (not absolute paths) so esbuild resolves them via `nodePaths`.
|
||||
*/
|
||||
function bareDriveBundleNodeBuiltinAliases() {
|
||||
return {
|
||||
assert: 'bare-assert',
|
||||
crypto: 'bare-crypto',
|
||||
events: 'bare-node-events',
|
||||
fs: 'bare-node-fs',
|
||||
net: 'bare-node-net',
|
||||
url: 'bare-url'
|
||||
}
|
||||
}
|
||||
const manifestPath = join(
|
||||
repoRoot,
|
||||
'packages/bare-os-booter/lib/bare-module-manifest.json'
|
||||
@@ -141,7 +158,8 @@ export async function buildBareLibs() {
|
||||
format: 'iife',
|
||||
globalName: IIFE_GLOBAL,
|
||||
platform: 'node',
|
||||
nodePaths: [join(repoRoot, 'node_modules')],
|
||||
alias: bareDriveBundleNodeBuiltinAliases(),
|
||||
nodePaths: [booterNodeModules, join(repoRoot, 'node_modules')],
|
||||
plugins: [bareNativeConditionalImportsPlugin()],
|
||||
outfile,
|
||||
footer: { js: footer },
|
||||
|
||||
Reference in New Issue
Block a user