mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-09 03:03:18 +00:00
fix(bridge): use vue server build (#3515)
* fix(bridge): use vue server build * fix: remove unused import * refactor: resolve cjs version once Co-authored-by: Pooya Parsa <pyapar@gmail.com>
This commit is contained in:
parent
91256f5e76
commit
a5e19b1c57
@ -1,4 +1,4 @@
|
|||||||
import { useNuxt, resolveModule, addTemplate, resolveAlias } from '@nuxt/kit'
|
import { useNuxt, resolveModule, addTemplate, resolveAlias, extendWebpackConfig } from '@nuxt/kit'
|
||||||
import { NuxtModule } from '@nuxt/schema'
|
import { NuxtModule } from '@nuxt/schema'
|
||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
import { componentsTypeTemplate } from '../../nuxt3/src/components/templates'
|
import { componentsTypeTemplate } from '../../nuxt3/src/components/templates'
|
||||||
@ -22,9 +22,20 @@ export function setupAppBridge (_options: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolve vue2 builds
|
// Resolve vue2 builds
|
||||||
nuxt.options.alias.vue2 = resolveModule('vue/dist/vue.runtime.esm.js', { paths: nuxt.options.modulesDir })
|
const vue2ESM = resolveModule('vue/dist/vue.runtime.esm.js', { paths: nuxt.options.modulesDir })
|
||||||
|
const vue2CJS = resolveModule('vue/dist/vue.runtime.common.js', { paths: nuxt.options.modulesDir })
|
||||||
|
nuxt.options.alias.vue2 = vue2ESM
|
||||||
nuxt.options.build.transpile.push('vue')
|
nuxt.options.build.transpile.push('vue')
|
||||||
|
|
||||||
|
extendWebpackConfig((config) => {
|
||||||
|
(config.resolve.alias as any).vue2 = vue2CJS
|
||||||
|
}, { client: false })
|
||||||
|
nuxt.hook('vite:extendConfig', (config, { isServer }) => {
|
||||||
|
if (isServer && !nuxt.options.dev) {
|
||||||
|
(config.resolve.alias as any).vue2 = vue2CJS
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// Disable legacy fetch polyfills
|
// Disable legacy fetch polyfills
|
||||||
nuxt.options.fetch.server = false
|
nuxt.options.fetch.server = false
|
||||||
nuxt.options.fetch.client = false
|
nuxt.options.fetch.client = false
|
||||||
|
@ -165,7 +165,9 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
|||||||
'process.env.NUXT_FULL_STATIC': nitroContext._nuxt.fullStatic as unknown as string,
|
'process.env.NUXT_FULL_STATIC': nitroContext._nuxt.fullStatic as unknown as string,
|
||||||
'process.env.NITRO_PRESET': JSON.stringify(nitroContext.preset),
|
'process.env.NITRO_PRESET': JSON.stringify(nitroContext.preset),
|
||||||
'process.env.RUNTIME_CONFIG': devalue(nitroContext._nuxt.runtimeConfig),
|
'process.env.RUNTIME_CONFIG': devalue(nitroContext._nuxt.runtimeConfig),
|
||||||
'process.env.DEBUG': JSON.stringify(nitroContext._nuxt.dev)
|
'process.env.DEBUG': JSON.stringify(nitroContext._nuxt.dev),
|
||||||
|
// Needed for vue 2 server build
|
||||||
|
'commonjsGlobal.process.env.VUE_ENV': '"server"'
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user