fix: include prompt assets in standalone output
This commit is contained in:
@@ -10,6 +10,17 @@ const nextConfig: NextConfig = {
|
||||
// default `.next`.
|
||||
distDir: process.env.NEXT_DIST_DIR || '.next',
|
||||
output: process.env.VERCEL ? undefined : 'standalone',
|
||||
// Prompt loaders read Markdown dynamically at runtime, so Next.js cannot
|
||||
// discover these assets from static imports when producing standalone output.
|
||||
outputFileTracingIncludes: {
|
||||
'/*': [
|
||||
'./lib/prompts/**/*.md',
|
||||
'./lib/pbl/v2/prompts/**/*.md',
|
||||
'./packages/@openmaic/generation/templates/**/*.md',
|
||||
'./packages/@openmaic/generation/snippets/**/*.md',
|
||||
'./packages/@openmaic/generation/prompts-pbl/**/*.md',
|
||||
],
|
||||
},
|
||||
...(basePath ? { basePath } : {}),
|
||||
env: {
|
||||
NEXT_PUBLIC_OPENMAIC_BASE_PATH: basePath,
|
||||
|
||||
19
OpenMAIC/tests/config/standalone-prompt-assets.test.ts
Normal file
19
OpenMAIC/tests/config/standalone-prompt-assets.test.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import nextConfig from '../../next.config';
|
||||
|
||||
const runtimePromptGlobs = [
|
||||
'./lib/prompts/**/*.md',
|
||||
'./lib/pbl/v2/prompts/**/*.md',
|
||||
'./packages/@openmaic/generation/templates/**/*.md',
|
||||
'./packages/@openmaic/generation/snippets/**/*.md',
|
||||
'./packages/@openmaic/generation/prompts-pbl/**/*.md',
|
||||
];
|
||||
|
||||
describe('standalone prompt assets', () => {
|
||||
it('includes every dynamically loaded prompt directory in output file tracing', () => {
|
||||
expect(nextConfig.outputFileTracingIncludes?.['/*']).toEqual(
|
||||
expect.arrayContaining(runtimePromptGlobs),
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user