mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(vite-node): entry path and executing in production (#3854)
This commit is contained in:
parent
cd8dbdc01c
commit
11c460fa99
@ -3,7 +3,9 @@ export default {
|
|||||||
* Set to true to generate an async entrypoint for the Vue bundle (for module federation support).
|
* Set to true to generate an async entrypoint for the Vue bundle (for module federation support).
|
||||||
* @version 3
|
* @version 3
|
||||||
*/
|
*/
|
||||||
asyncEntry: false,
|
asyncEntry: {
|
||||||
|
$resolve: (val, get) => val ?? (get('dev') && get('experimental.viteNode')) ?? false
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use vite-node for on-demand server chunk loading
|
* Use vite-node for on-demand server chunk loading
|
||||||
|
@ -33,6 +33,7 @@ function createViteNodeMiddleware (ctx: ViteBuildContext): Connect.NextHandleFun
|
|||||||
node = new ViteNodeServer(ctx.ssrServer, {
|
node = new ViteNodeServer(ctx.ssrServer, {
|
||||||
deps: {
|
deps: {
|
||||||
inline: [
|
inline: [
|
||||||
|
'nuxt3',
|
||||||
...ctx.nuxt.options.build.transpile as string[]
|
...ctx.nuxt.options.build.transpile as string[]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -55,7 +56,11 @@ function createViteNodeMiddleware (ctx: ViteBuildContext): Connect.NextHandleFun
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function prepareDevServerEntry (ctx: ViteBuildContext) {
|
export async function prepareDevServerEntry (ctx: ViteBuildContext) {
|
||||||
const entryPath = resolve(ctx.nuxt.options.appDir, 'entry.async')
|
let entryPath = resolve(ctx.nuxt.options.appDir, 'entry.async.mjs')
|
||||||
|
if (!fse.existsSync(entryPath)) {
|
||||||
|
entryPath = resolve(ctx.nuxt.options.appDir, 'entry.async')
|
||||||
|
}
|
||||||
|
|
||||||
const raw = await fse.readFile(resolve(distDir, 'runtime/server.mjs'), 'utf-8')
|
const raw = await fse.readFile(resolve(distDir, 'runtime/server.mjs'), 'utf-8')
|
||||||
const host = ctx.nuxt.options.server.host || 'localhost'
|
const host = ctx.nuxt.options.server.host || 'localhost'
|
||||||
const port = ctx.nuxt.options.server.port || '3000'
|
const port = ctx.nuxt.options.server.port || '3000'
|
||||||
|
@ -3,5 +3,8 @@ import { defineNuxtConfig } from 'nuxt3'
|
|||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
modules: [
|
modules: [
|
||||||
'@nuxt/ui'
|
'@nuxt/ui'
|
||||||
]
|
],
|
||||||
|
experimental: {
|
||||||
|
viteNode: true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user