mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 09:22:27 +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')
|
'#internal/nitro': resolve(ctx.nuxt.options.buildDir, 'nitro.client.mjs')
|
||||||
},
|
},
|
||||||
dedupe: [
|
dedupe: [
|
||||||
'vue',
|
'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'
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
cacheDir: resolve(ctx.nuxt.options.rootDir, 'node_modules/.cache/vite', 'client'),
|
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 * as vite from 'vite'
|
||||||
import vuePlugin from '@vitejs/plugin-vue'
|
import vuePlugin from '@vitejs/plugin-vue'
|
||||||
import viteJsxPlugin from '@vitejs/plugin-vue-jsx'
|
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 { joinURL, withTrailingSlash, withoutLeadingSlash } from 'ufo'
|
||||||
import type { ViteConfig } from '@nuxt/schema'
|
import type { ViteConfig } from '@nuxt/schema'
|
||||||
import type { ViteBuildContext } from './vite'
|
import type { ViteBuildContext } from './vite'
|
||||||
@ -15,6 +15,7 @@ import { transpile } from './utils/transpile'
|
|||||||
export async function buildServer (ctx: ViteBuildContext) {
|
export async function buildServer (ctx: ViteBuildContext) {
|
||||||
const helper = ctx.nuxt.options.nitro.imports !== false ? '' : 'globalThis.'
|
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 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, {
|
const serverConfig: ViteConfig = vite.mergeConfig(ctx.config, {
|
||||||
configFile: false,
|
configFile: false,
|
||||||
base: ctx.nuxt.options.dev
|
base: ctx.nuxt.options.dev
|
||||||
@ -56,12 +57,9 @@ export async function buildServer (ctx: ViteBuildContext) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
ssr: {
|
ssr: {
|
||||||
external: ['#internal/nitro', '#internal/nitro/utils'],
|
external: ['#internal/nitro', '#internal/nitro/utils', ...nitroDependencies],
|
||||||
noExternal: [
|
noExternal: [
|
||||||
...transpile({ isServer: true, isDev: ctx.nuxt.options.dev }),
|
...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',
|
'/__vue-jsx',
|
||||||
'#app',
|
'#app',
|
||||||
/^nuxt(\/|$)/,
|
/^nuxt(\/|$)/,
|
||||||
|
@ -76,7 +76,7 @@ export async function bundle (nuxt: Nuxt) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
include: ['vue', '@vue/reactivity', '@vue/runtime-core', '@vue/runtime-dom', '@vue/shared'],
|
include: ['vue'],
|
||||||
exclude: ['nuxt/app']
|
exclude: ['nuxt/app']
|
||||||
},
|
},
|
||||||
css: resolveCSSOptions(nuxt),
|
css: resolveCSSOptions(nuxt),
|
||||||
|
Loading…
Reference in New Issue
Block a user