mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(nuxt)!: remove old experimental options (#27749)
This commit is contained in:
parent
ae12d72a40
commit
69f09fbae1
@ -57,20 +57,6 @@ export default defineNuxtConfig({
|
|||||||
This feature will likely be removed in a near future.
|
This feature will likely be removed in a near future.
|
||||||
::
|
::
|
||||||
|
|
||||||
## treeshakeClientOnly
|
|
||||||
|
|
||||||
Tree shakes contents of client-only components from server bundle.
|
|
||||||
|
|
||||||
*Enabled by default.*
|
|
||||||
|
|
||||||
```ts twoslash [nuxt.config.ts]
|
|
||||||
export default defineNuxtConfig({
|
|
||||||
experimental: {
|
|
||||||
treeshakeClientOnly: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
## emitRouteChunkError
|
## emitRouteChunkError
|
||||||
|
|
||||||
Emits `app:chunkError` hook when there is an error loading vite/webpack chunks. Default behavior is to perform a hard reload of the new route when a chunk fails to load.
|
Emits `app:chunkError` hook when there is an error loading vite/webpack chunks. Default behavior is to perform a hard reload of the new route when a chunk fails to load.
|
||||||
@ -238,44 +224,6 @@ export default defineNuxtConfig({
|
|||||||
You can follow the server components roadmap on GitHub.
|
You can follow the server components roadmap on GitHub.
|
||||||
::
|
::
|
||||||
|
|
||||||
## configSchema
|
|
||||||
|
|
||||||
Enables config schema support.
|
|
||||||
|
|
||||||
*Enabled by default.*
|
|
||||||
|
|
||||||
```ts twoslash [nuxt.config.ts]
|
|
||||||
export default defineNuxtConfig({
|
|
||||||
experimental: {
|
|
||||||
configSchema: true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
## polyfillVueUseHead
|
|
||||||
|
|
||||||
Adds a compatibility layer for modules, plugins, or user code relying on the old `@vueuse/head` API.
|
|
||||||
|
|
||||||
```ts twoslash [nuxt.config.ts]
|
|
||||||
export default defineNuxtConfig({
|
|
||||||
experimental: {
|
|
||||||
polyfillVueUseHead: false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
## respectNoSSRHeader
|
|
||||||
|
|
||||||
Allow disabling Nuxt SSR responses by setting the `x-nuxt-no-ssr` header.
|
|
||||||
|
|
||||||
```ts twoslash [nuxt.config.ts]
|
|
||||||
export default defineNuxtConfig({
|
|
||||||
experimental: {
|
|
||||||
respectNoSSRHeader: false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
## localLayerAliases
|
## localLayerAliases
|
||||||
|
|
||||||
Resolve `~`, `~~`, `@` and `@@` aliases located within layers with respect to their layer source and root directories.
|
Resolve `~`, `~~`, `@` and `@@` aliases located within layers with respect to their layer source and root directories.
|
||||||
|
@ -216,7 +216,7 @@ export default defineNuxtModule<ComponentsOptions>({
|
|||||||
const mode = isClient ? 'client' : 'server'
|
const mode = isClient ? 'client' : 'server'
|
||||||
|
|
||||||
config.plugins = config.plugins || []
|
config.plugins = config.plugins || []
|
||||||
if (nuxt.options.experimental.treeshakeClientOnly && isServer) {
|
if (isServer) {
|
||||||
config.plugins.push(TreeShakeTemplatePlugin.vite({
|
config.plugins.push(TreeShakeTemplatePlugin.vite({
|
||||||
sourcemap: !!nuxt.options.sourcemap[mode],
|
sourcemap: !!nuxt.options.sourcemap[mode],
|
||||||
getComponents,
|
getComponents,
|
||||||
@ -285,7 +285,7 @@ export default defineNuxtModule<ComponentsOptions>({
|
|||||||
configs.forEach((config) => {
|
configs.forEach((config) => {
|
||||||
const mode = config.name === 'client' ? 'client' : 'server'
|
const mode = config.name === 'client' ? 'client' : 'server'
|
||||||
config.plugins = config.plugins || []
|
config.plugins = config.plugins || []
|
||||||
if (nuxt.options.experimental.treeshakeClientOnly && mode === 'server') {
|
if (mode === 'server') {
|
||||||
config.plugins.push(TreeShakeTemplatePlugin.webpack({
|
config.plugins.push(TreeShakeTemplatePlugin.webpack({
|
||||||
sourcemap: !!nuxt.options.sourcemap[mode],
|
sourcemap: !!nuxt.options.sourcemap[mode],
|
||||||
getComponents,
|
getComponents,
|
||||||
|
@ -343,15 +343,6 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add backward-compatible middleware to respect `x-nuxt-no-ssr` header
|
|
||||||
if (nuxt.options.experimental.respectNoSSRHeader) {
|
|
||||||
nitroConfig.handlers = nitroConfig.handlers || []
|
|
||||||
nitroConfig.handlers.push({
|
|
||||||
handler: resolve(distDir, 'core/runtime/nitro/no-ssr'),
|
|
||||||
middleware: true,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Register nuxt protection patterns
|
// Register nuxt protection patterns
|
||||||
nitroConfig.rollupConfig!.plugins = await nitroConfig.rollupConfig!.plugins || []
|
nitroConfig.rollupConfig!.plugins = await nitroConfig.rollupConfig!.plugins || []
|
||||||
nitroConfig.rollupConfig!.plugins = toArray(nitroConfig.rollupConfig!.plugins)
|
nitroConfig.rollupConfig!.plugins = toArray(nitroConfig.rollupConfig!.plugins)
|
||||||
|
@ -20,9 +20,6 @@ export default defineNuxtModule({
|
|||||||
name: 'nuxt-config-schema',
|
name: 'nuxt-config-schema',
|
||||||
},
|
},
|
||||||
async setup (_, nuxt) {
|
async setup (_, nuxt) {
|
||||||
if (!nuxt.options.experimental.configSchema) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const resolver = createResolver(import.meta.url)
|
const resolver = createResolver(import.meta.url)
|
||||||
|
|
||||||
// Initialize untyped/jiti loader
|
// Initialize untyped/jiti loader
|
||||||
|
@ -52,11 +52,6 @@ export default defineNuxtModule<NuxtOptions['unhead']>({
|
|||||||
|
|
||||||
// Opt-out feature allowing dependencies using @vueuse/head to work
|
// Opt-out feature allowing dependencies using @vueuse/head to work
|
||||||
const unheadVue = await tryResolveModule('@unhead/vue', nuxt.options.modulesDir) || '@unhead/vue'
|
const unheadVue = await tryResolveModule('@unhead/vue', nuxt.options.modulesDir) || '@unhead/vue'
|
||||||
if (nuxt.options.experimental.polyfillVueUseHead) {
|
|
||||||
// backwards compatibility
|
|
||||||
nuxt.options.alias['@vueuse/head'] = unheadVue
|
|
||||||
addPlugin({ src: resolve(runtimeDir, 'plugins/vueuse-head-polyfill') })
|
|
||||||
}
|
|
||||||
|
|
||||||
addTemplate({
|
addTemplate({
|
||||||
filename: 'unhead-plugins.mjs',
|
filename: 'unhead-plugins.mjs',
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
import { polyfillAsVueUseHead } from '@unhead/vue/polyfill'
|
|
||||||
import { defineNuxtPlugin } from '#app/nuxt'
|
|
||||||
|
|
||||||
export default defineNuxtPlugin({
|
|
||||||
name: 'nuxt:vueuse-head-polyfill',
|
|
||||||
setup (nuxtApp) {
|
|
||||||
// avoid breaking ecosystem dependencies using low-level @vueuse/head APIs
|
|
||||||
polyfillAsVueUseHead(nuxtApp.vueApp._context.provides.usehead)
|
|
||||||
},
|
|
||||||
})
|
|
@ -106,22 +106,6 @@ export default defineUntypedSchema({
|
|||||||
*/
|
*/
|
||||||
externalVue: true,
|
externalVue: true,
|
||||||
|
|
||||||
/**
|
|
||||||
* Tree shakes contents of client-only components from server bundle.
|
|
||||||
* @see [Nuxt PR #5750](https://github.com/nuxt/framework/pull/5750)
|
|
||||||
* @deprecated This option will no longer be configurable in Nuxt v4
|
|
||||||
*/
|
|
||||||
treeshakeClientOnly: {
|
|
||||||
async $resolve (val, get) {
|
|
||||||
const isV4 = ((await get('future') as Record<string, unknown>).compatibilityVersion === 4)
|
|
||||||
if (isV4 && val === false) {
|
|
||||||
console.warn('Enabling `experimental.treeshakeClientOnly` in v4 compatibility mode as it will no longer be configurable in Nuxt v4.')
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return val ?? true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emit `app:chunkError` hook when there is an error loading vite/webpack
|
* Emit `app:chunkError` hook when there is an error loading vite/webpack
|
||||||
* chunks.
|
* chunks.
|
||||||
@ -226,55 +210,6 @@ export default defineUntypedSchema({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Config schema support
|
|
||||||
* @see [Nuxt Issue #15592](https://github.com/nuxt/nuxt/issues/15592)
|
|
||||||
* @deprecated This option will no longer be configurable in Nuxt v4
|
|
||||||
*/
|
|
||||||
configSchema: {
|
|
||||||
async $resolve (val, get) {
|
|
||||||
const isV4 = ((await get('future') as Record<string, unknown>).compatibilityVersion === 4)
|
|
||||||
if (isV4 && val === false) {
|
|
||||||
console.warn('Enabling `experimental.configSchema` in v4 compatibility mode as it will no longer be configurable in Nuxt v4.')
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return val ?? true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether or not to add a compatibility layer for modules, plugins or user code relying on the old
|
|
||||||
* `@vueuse/head` API.
|
|
||||||
*
|
|
||||||
* This is disabled to reduce the client-side bundle by ~0.5kb.
|
|
||||||
* @deprecated This feature will be removed in Nuxt v4.
|
|
||||||
*/
|
|
||||||
polyfillVueUseHead: {
|
|
||||||
async $resolve (val, get) {
|
|
||||||
const isV4 = ((await get('future') as Record<string, unknown>).compatibilityVersion === 4)
|
|
||||||
if (isV4 && val === true) {
|
|
||||||
console.warn('Disabling `experimental.polyfillVueUseHead` in v4 compatibility mode as it will no longer be configurable in Nuxt v4.')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return val ?? false
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allow disabling Nuxt SSR responses by setting the `x-nuxt-no-ssr` header.
|
|
||||||
* @deprecated This feature will be removed in Nuxt v4.
|
|
||||||
*/
|
|
||||||
respectNoSSRHeader: {
|
|
||||||
async $resolve (val, get) {
|
|
||||||
const isV4 = ((await get('future') as Record<string, unknown>).compatibilityVersion === 4)
|
|
||||||
if (isV4 && val === true) {
|
|
||||||
console.warn('Disabling `experimental.respectNoSSRHeader` in v4 compatibility mode as it will no longer be configurable in Nuxt v4.')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return val ?? false
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
/** Resolve `~`, `~~`, `@` and `@@` aliases located within layers with respect to their layer source and root directories. */
|
/** Resolve `~`, `~~`, `@` and `@@` aliases located within layers with respect to their layer source and root directories. */
|
||||||
localLayerAliases: true,
|
localLayerAliases: true,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user