In packaged Electron apps process.cwd() does not point to the app directory so the mcp-server bundle was never found. Additionally the mcp-server dist was not included in the package at all. Changes: - Bundle mcp-server into a single self-contained ESM file (tsup noExternal + createRequire banner for CJS compat) - Ship mcp-server/dist/index.js and package.json via extraResources - Resolve entry via process.resourcesPath when app.isPackaged is true - Build controller + mcp-server in prebuild so dist exists before electron-builder runs - Add mcp-server/dist/index.js to CI verify steps on all platforms - Improve error message to list checked paths for easier debugging
31 lines
1,012 B
TypeScript
31 lines
1,012 B
TypeScript
import { defineConfig } from 'tsup';
|
|
|
|
export default defineConfig({
|
|
entry: ['src/index.ts'],
|
|
format: ['esm'],
|
|
target: 'node20',
|
|
platform: 'node',
|
|
outDir: 'dist',
|
|
clean: true,
|
|
sourcemap: true,
|
|
dts: false,
|
|
// Bundle all dependencies into a single self-contained file so the packaged
|
|
// Electron app can run the MCP server without a node_modules tree.
|
|
noExternal: [/.*/],
|
|
splitting: false,
|
|
// Provide a real `require` function for CJS dependencies (e.g. undici)
|
|
// that use require() for Node built-in modules.
|
|
banner: {
|
|
js: `import { createRequire as __bundled_createRequire } from 'module';\nconst require = __bundled_createRequire(import.meta.url);`,
|
|
},
|
|
esbuildOptions(options) {
|
|
// Optional peer deps of xsschema (pulled in by fastmcp) — we only use zod.
|
|
// Mark as external at the esbuild level to avoid resolution errors.
|
|
options.external = [
|
|
...(options.external ?? []),
|
|
'sury',
|
|
'@valibot/to-json-schema',
|
|
'effect',
|
|
];
|
|
},
|
|
});
|