mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(vite): add file://
protocol to vite-node
entry file path (#4966)
This commit is contained in:
parent
2886dfdaea
commit
bd80d27a49
@ -1,3 +1,4 @@
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { createApp, createError, defineEventHandler, defineLazyEventHandler } from 'h3'
|
||||
import { ViteNodeServer } from 'vite-node/server'
|
||||
import fse from 'fs-extra'
|
||||
@ -97,12 +98,15 @@ export async function prepareDevServerEntry (ctx: ViteBuildContext) {
|
||||
}
|
||||
process.env.NUXT_VITE_NODE_OPTIONS = JSON.stringify(viteNodeServerOptions)
|
||||
|
||||
const serverResolvedPath = resolve(distDir, 'runtime/vite-node.mjs')
|
||||
const manifestResolvedPath = resolve(distDir, 'runtime/client.manifest.mjs')
|
||||
|
||||
await fse.writeFile(
|
||||
resolve(ctx.nuxt.options.buildDir, 'dist/server/server.mjs'),
|
||||
`export { default } from ${JSON.stringify(resolve(distDir, 'runtime/vite-node.mjs'))}`
|
||||
`export { default } from ${JSON.stringify(pathToFileURL(serverResolvedPath).href)}`
|
||||
)
|
||||
await fse.writeFile(
|
||||
resolve(ctx.nuxt.options.buildDir, 'dist/server/client.manifest.mjs'),
|
||||
`export { default } from ${JSON.stringify(resolve(distDir, 'runtime/client.manifest.mjs'))}`
|
||||
`export { default } from ${JSON.stringify(pathToFileURL(manifestResolvedPath).href)}`
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user