Revert Docker build fix

This commit is contained in:
Konstantin Wohlwend
2026-03-09 10:06:14 -07:00
parent 48ac83e858
commit 00fd0eb4c8
3 changed files with 12 additions and 12 deletions
@@ -1,3 +1,4 @@
import { readFileSync } from 'node:fs';
import { builtinModules } from 'node:module';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -9,11 +10,19 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const backendDir = resolve(__dirname, '..');
const packageJson = JSON.parse(readFileSync(resolve(backendDir, 'package.json'), 'utf-8'));
// Packages that must remain as runtime imports (can't be statically bundled)
const externalPackages = [
'@prisma/client',
];
const customNoExternal = new Set([
...Object.keys(packageJson.dependencies).filter(
(dep) => !externalPackages.some((ext) => dep === ext || dep.startsWith(ext + '/'))
),
]);
// Node.js built-in modules that should not be bundled
const nodeBuiltins = builtinModules.flatMap((m) => [m, `node:${m}`]);
@@ -25,8 +34,7 @@ export default defineConfig({
outDir: resolve(backendDir, 'dist'),
target: 'node22',
platform: 'node',
// Bundle all non-Node modules into the migration artifact, except Prisma runtime.
noExternal: true,
noExternal: [...customNoExternal],
inlineOnly: false,
// Externalize Node.js builtins so they're imported rather than shimmed
external: [...nodeBuiltins, ...externalPackages],