mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
fix(vite): remove @vue/ scoped libraries from resolutions (#21922)
This commit is contained in:
parent
fd2b36a64d
commit
958562086f
@ -52,11 +52,7 @@ export async function buildClient (ctx: ViteBuildContext) {
|
||||
'#internal/nitro': resolve(ctx.nuxt.options.buildDir, 'nitro.client.mjs')
|
||||
},
|
||||
dedupe: [
|
||||
'vue',
|
||||
// basic reactivity
|
||||
'@vue/reactivity', '@vue/runtime-core', '@vue/runtime-dom', '@vue/shared',
|
||||
// runtime compiler
|
||||
'@vue/compiler-sfc', '@vue/compiler-dom', '@vue/compiler-core', '@vue/compiler-ssr'
|
||||
'vue'
|
||||
]
|
||||
},
|
||||
cacheDir: resolve(ctx.nuxt.options.rootDir, 'node_modules/.cache/vite', 'client'),
|
||||
|
@ -2,7 +2,7 @@ import { resolve } from 'pathe'
|
||||
import * as vite from 'vite'
|
||||
import vuePlugin from '@vitejs/plugin-vue'
|
||||
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
|
||||
import { logger, resolvePath } from '@nuxt/kit'
|
||||
import { logger, resolvePath, tryResolveModule } from '@nuxt/kit'
|
||||
import { joinURL, withTrailingSlash, withoutLeadingSlash } from 'ufo'
|
||||
import type { ViteConfig } from '@nuxt/schema'
|
||||
import type { ViteBuildContext } from './vite'
|
||||
@ -15,6 +15,7 @@ import { transpile } from './utils/transpile'
|
||||
export async function buildServer (ctx: ViteBuildContext) {
|
||||
const helper = ctx.nuxt.options.nitro.imports !== false ? '' : 'globalThis.'
|
||||
const entry = ctx.nuxt.options.ssr ? ctx.entry : await resolvePath(resolve(ctx.nuxt.options.appDir, 'entry-spa'))
|
||||
const nitroDependencies = await tryResolveModule('nitropack/package.json', ctx.nuxt.options.modulesDir).then(r => import(r!)).then(r => Object.keys(r.dependencies || {})).catch(() => [])
|
||||
const serverConfig: ViteConfig = vite.mergeConfig(ctx.config, {
|
||||
configFile: false,
|
||||
base: ctx.nuxt.options.dev
|
||||
@ -56,12 +57,9 @@ export async function buildServer (ctx: ViteBuildContext) {
|
||||
}
|
||||
},
|
||||
ssr: {
|
||||
external: ['#internal/nitro', '#internal/nitro/utils'],
|
||||
external: ['#internal/nitro', '#internal/nitro/utils', ...nitroDependencies],
|
||||
noExternal: [
|
||||
...transpile({ isServer: true, isDev: ctx.nuxt.options.dev }),
|
||||
// TODO: Use externality for production (rollup) build
|
||||
/\/esm\/.*\.js$/,
|
||||
/\.(es|esm|esm-browser|esm-bundler).js$/,
|
||||
'/__vue-jsx',
|
||||
'#app',
|
||||
/^nuxt(\/|$)/,
|
||||
|
@ -76,7 +76,7 @@ export async function bundle (nuxt: Nuxt) {
|
||||
}
|
||||
},
|
||||
optimizeDeps: {
|
||||
include: ['vue', '@vue/reactivity', '@vue/runtime-core', '@vue/runtime-dom', '@vue/shared'],
|
||||
include: ['vue'],
|
||||
exclude: ['nuxt/app']
|
||||
},
|
||||
css: resolveCSSOptions(nuxt),
|
||||
|
Loading…
Reference in New Issue
Block a user