diff --git a/apps/sim/next.config.test.ts b/apps/sim/next.config.test.ts new file mode 100644 index 00000000000..3e943b58409 --- /dev/null +++ b/apps/sim/next.config.test.ts @@ -0,0 +1,11 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import nextConfig from '@/next.config' + +describe('Next.js server dependency packaging', () => { + it('keeps pdfjs external to the production server bundle', () => { + expect(nextConfig.serverExternalPackages).toContain('pdfjs-dist') + }) +}) diff --git a/apps/sim/next.config.ts b/apps/sim/next.config.ts index 261091bffbc..1b1489c7e69 100644 --- a/apps/sim/next.config.ts +++ b/apps/sim/next.config.ts @@ -99,6 +99,11 @@ const nextConfig: NextConfig = { '@daytona/sdk', '@earendil-works/pi-ai', '@earendil-works/pi-coding-agent', + /** + * PDF.js loads its worker and optional canvas primitives relative to its package at runtime. + * Bundling relocates that code and leaves DOMMatrix unavailable in the standalone image. + */ + 'pdfjs-dist', // The collab-doc seed converter lazily `require`s jsdom for a headless TipTap editor. Keep it // external so webpack doesn't try to bundle jsdom's dynamic internal requires. 'jsdom',