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

fix(nuxt): resolve vue/server-renderer and vue/compiler-sfc #4488

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"prepack": "unbuild"
},
"dependencies": {
"@nuxt/devalue": "^2.0.0",
"@nuxt/kit": "^3.0.0-rc.1",
"@nuxt/schema": "^3.0.0-rc.1",
"@nuxt/telemetry": "^2.1.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/nuxt/src/core/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { resolve, join } from 'pathe'
import { createNitro, createDevServer, build, prepare, copyPublicAssets, writeTypes, scanHandlers, prerender } from 'nitropack'
import type { NitroEventHandler, NitroDevEventHandler, NitroConfig } from 'nitropack'
import type { Nuxt } from '@nuxt/schema'
import { resolvePath } from '@nuxt/kit'
import defu from 'defu'
import fsExtra from 'fs-extra'
import { toEventHandler, dynamicEventHandler } from 'h3'
import { resolvePath } from 'mlly'
import { distDir } from '../dirs'
import { ImportProtectionPlugin } from './plugins/import-protection'

Expand Down Expand Up @@ -64,8 +64,8 @@ export async function initNitro (nuxt: Nuxt) {
},
alias: {
// TODO: #590
'vue/server-renderer': 'vue/server-renderer',
'vue/compiler-sfc': 'vue/compiler-sfc',
'vue/server-renderer': await resolvePath('vue/server-renderer', { conditions: ['import'] }),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess mlly resolver should apply import condition by default following module resolution. But we can path url (as node modules dir search path to it so that if a newer version is specified by users will be picked, same as resolvePath in kit)

'vue/compiler-sfc': await resolvePath('vue/compiler-sfc', { conditions: ['import'] }),
vue: await resolvePath(`vue/dist/vue.cjs${nuxt.options.dev ? '' : '.prod'}.js`),

// Vue 3 mocks
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10031,6 +10031,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "nuxt@workspace:packages/nuxt"
dependencies:
"@nuxt/devalue": ^2.0.0
"@nuxt/kit": ^3.0.0-rc.1
"@nuxt/schema": ^3.0.0-rc.1
"@nuxt/telemetry": ^2.1.2
Expand Down