Skip to content

Commit b8d52c0

Browse files
authored
fix(nuxt): avoid external nitropack runtime barrel (#18)
1 parent ed74a5a commit b8d52c0

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/nitro.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function resolveRuntimePlugin(): string {
3333
export const RUNTIME_PLUGIN_PATH = resolveRuntimePlugin()
3434

3535
export function resolveRuntimeConfigImport(frameworkName = 'nitro'): string {
36-
return frameworkName === 'nitro' ? 'nitro/runtime-config' : 'nitropack/runtime'
36+
return frameworkName === 'nitro' ? 'nitro/runtime-config' : 'nitropack/runtime/config'
3737
}
3838

3939
async function writeFileIfChanged(file: string, contents: string): Promise<void> {

test/validation.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ describe('runtime JSON Schema generation', () => {
109109

110110
execSync('pnpm nuxi build', { cwd: fixtureDir, stdio: 'pipe' })
111111

112-
expect(existsSync(join(fixtureDir, '.output/server/index.mjs'))).toBe(true)
112+
const serverEntry = join(fixtureDir, '.output/server/index.mjs')
113+
const nitroChunk = join(fixtureDir, '.output/server/chunks/nitro/nitro.mjs')
114+
expect(existsSync(serverEntry)).toBe(true)
115+
116+
const serverOutput = `${readFileSync(serverEntry, 'utf-8')}\n${readFileSync(nitroChunk, 'utf-8')}`
117+
expect(serverOutput).not.toContain('nitropack/runtime')
118+
expect(serverOutput).not.toContain('#nitro-internal-virtual')
113119
}, 60000)
114120

115121
it('generates runtime validation template (Zod native)', async () => {

0 commit comments

Comments
 (0)