mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(vite): normalise entry id for typeCheck
plugin (#24114)
This commit is contained in:
parent
9ef94d6afb
commit
38b6d88cfa
@ -135,7 +135,7 @@ export async function buildClient (ctx: ViteBuildContext) {
|
||||
}
|
||||
|
||||
// Add type checking client panel
|
||||
if (ctx.nuxt.options.typescript.typeCheck && ctx.nuxt.options.dev) {
|
||||
if (ctx.nuxt.options.typescript.typeCheck === true && ctx.nuxt.options.dev) {
|
||||
clientConfig.plugins!.push(typeCheckPlugin({ sourcemap: !!ctx.nuxt.options.sourcemap.client }))
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
import MagicString from 'magic-string'
|
||||
import type { Plugin } from 'vite'
|
||||
|
||||
const QUERY_RE = /\?.+$/
|
||||
|
||||
export function typeCheckPlugin (options: { sourcemap?: boolean } = {}): Plugin {
|
||||
let entry: string
|
||||
return {
|
||||
@ -12,7 +14,7 @@ export function typeCheckPlugin (options: { sourcemap?: boolean } = {}): Plugin
|
||||
}
|
||||
},
|
||||
transform (code, id) {
|
||||
if (id !== entry) { return }
|
||||
if (id.replace(QUERY_RE, '') !== entry) { return }
|
||||
|
||||
const s = new MagicString(code)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user