Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix: use legacy commonjs transform plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jun 20, 2022
1 parent be5d822 commit 986264a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/vite/src/server.ts
Expand Up @@ -26,7 +26,7 @@ export async function buildServer (ctx: ViteBuildContext) {
resolve: {
alias: {
'#build/plugins': resolve(ctx.nuxt.options.buildDir, 'plugins/server'),
...ctx.nuxt.options.experimental.externalVue
...ctx.nuxt.options.experimental.externalVue || ctx.nuxt.options.dev
? {}
: {
'@vue/reactivity': _resolve(`@vue/reactivity/dist/reactivity.cjs${ctx.nuxt.options.dev ? '' : '.prod'}.js`),
Expand All @@ -39,7 +39,9 @@ export async function buildServer (ctx: ViteBuildContext) {
}
},
ssr: {
external: ctx.nuxt.options.experimental.externalVue ? ['#internal/nitro', '#internal/nitro/utils', 'vue', 'vue-router'] : ['#internal/nitro', '#internal/nitro/utils'],
external: ctx.nuxt.options.experimental.externalVue
? ['#internal/nitro', '#internal/nitro/utils', 'vue', 'vue-router']
: ['#internal/nitro', '#internal/nitro/utils'],
noExternal: [
...ctx.nuxt.options.build.transpile,
// TODO: Use externality for production (rollup) build
Expand Down
3 changes: 3 additions & 0 deletions packages/vite/src/vite.ts
Expand Up @@ -30,6 +30,9 @@ export async function bundle (nuxt: Nuxt) {
nuxt,
config: vite.mergeConfig(
{
legacy: {
buildRollupPluginCommonjs: !nuxt.options.experimental.externalVue
},
resolve: {
alias: {
...nuxt.options.alias,
Expand Down
2 changes: 0 additions & 2 deletions test/fixtures/basic/nuxt.config.ts
Expand Up @@ -28,8 +28,6 @@ export default defineNuxtConfig({
}
},
experimental: {
// TODO: enable by default or work around the need for this
externalVue: true,
reactivityTransform: true
}
})

0 comments on commit 986264a

Please sign in to comment.