Skip to content

Commit

Permalink
fix(vue-tsc): sync changeExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework committed Jul 9, 2024
1 parent 9bed0fb commit 42228c5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/vite-plugin-checker/src/checkers/vueTsc/prepareVueTsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,19 @@ async function overrideTscJs(tscJsPath: string) {
(s) => s + `.map((group, i) => i === 0 ? group.splice(0, 0, ${extsText}) && group : group)`
)

const extsText2 = extraSupportedExtensions.map((ext) => `"${ext}"`).join(', ')
tsc = replace(
tsc,
/function changeExtension\(/,
(s) =>
// biome-ignore lint/style/useTemplate: <explanation>
`function changeExtension(path, newExtension) {
return [${extsText2}].some(ext => path.endsWith(ext))
? path + newExtension
: _changeExtension(path, newExtension)
}\n` + s.replace('changeExtension', '_changeExtension')
)

// proxy createProgram
tsc = replace(
tsc,
Expand Down

0 comments on commit 42228c5

Please sign in to comment.