refactor(schema): move runtimeCompiler option out of experimental (#20606)

This commit is contained in:
Daniel Roe 2023-05-01 17:39:07 +01:00 committed by GitHub
parent 8353e4c66e
commit 8b86d39e30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 10 deletions

View File

@ -130,7 +130,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
],
traceInclude: [
// force include files used in generated code from the runtime-compiler
...(nuxt.options.experimental.runtimeVueCompiler && !nuxt.options.experimental.externalVue)
...(nuxt.options.vue.runtimeCompiler && !nuxt.options.experimental.externalVue)
? [
...nuxt.options.modulesDir.reduce<string[]>((targets, path) => {
const serverRendererPath = resolve(path, 'vue/server-renderer/index.js')
@ -150,7 +150,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
vue: await resolvePath(`vue/dist/vue.cjs${nuxt.options.dev ? '' : '.prod'}.js`)
},
// Vue 3 mocks
...nuxt.options.experimental.runtimeVueCompiler || nuxt.options.experimental.externalVue
...nuxt.options.vue.runtimeCompiler || nuxt.options.experimental.externalVue
? {}
: {
'estree-walker': 'unenv/runtime/mock/proxy',
@ -253,7 +253,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
})
// Enable runtime compiler client side
if (nuxt.options.experimental.runtimeVueCompiler) {
if (nuxt.options.vue.runtimeCompiler) {
nuxt.hook('vite:extendConfig', (config, { isClient }) => {
if (isClient) {
if (Array.isArray(config.resolve!.alias)) {

View File

@ -13,6 +13,13 @@ export default defineUntypedSchema({
* @type {typeof import('@vue/compiler-core').CompilerOptions}
*/
compilerOptions: {},
/**
* Include Vue compiler in runtime bundle.
*/
runtimeCompiler: {
$resolve: async (val, get) => val ?? await get('experimental.runtimeVueCompiler') ?? false,
},
},
/**

View File

@ -23,12 +23,6 @@ export default defineUntypedSchema({
*/
externalVue: true,
// TODO: move to `vue.runtimeCompiler` in v3.5
/**
* Include Vue compiler in runtime bundle.
*/
runtimeVueCompiler: false,
/**
* Tree shakes contents of client-only components from server bundle.
* @see https://github.com/nuxt/framework/pull/5750

View File

@ -1,8 +1,10 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
experimental: {
runtimeVueCompiler: true,
externalVue: false
},
vue: {
runtimeCompiler: true
},
builder: process.env.TEST_BUILDER as 'webpack' | 'vite' ?? 'vite'
})