Skip to content

Commit 69a73a9

Browse files
committed
fix: require vue-tsc >= 1.3.9
1 parent 6d3887d commit 69a73a9

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

packages/vite-plugin-checker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"vite": ">=2.0.0",
6969
"vls": "*",
7070
"vti": "*",
71-
"vue-tsc": "*"
71+
"vue-tsc": ">=1.3.9"
7272
},
7373
"peerDependenciesMeta": {
7474
"eslint": {

packages/vite-plugin-checker/src/checkers/vueTsc/prepareVueTsc.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,7 @@ const _require = createRequire(import.meta.url)
1111
// isomorphic __dirname https://antfu.me/posts/isomorphic-dirname
1212
const _filename = fileURLToPath(import.meta.url)
1313
const _dirname = dirname(_filename)
14-
15-
let proxyApiPath: string
16-
let createProgramFunction: string
17-
try {
18-
// vue-tsc exposes the proxy in vue-tsc/out/index after v1.0.14
19-
proxyApiPath = _require.resolve('vue-tsc/out/index')
20-
createProgramFunction = 'createProgram'
21-
} catch (e) {
22-
// @deprecated
23-
// will be removed in 0.6.0
24-
// vue-tsc exposes the proxy in vue-tsc/out/proxy before v1.0.14
25-
proxyApiPath = _require.resolve('vue-tsc/out/proxy')
26-
createProgramFunction = 'createProgramProxy'
27-
}
14+
const proxyApiPath = _require.resolve('vue-tsc/out/index')
2815

2916
export async function prepareVueTsc() {
3017
// 1. copy typescript to folder
@@ -76,7 +63,7 @@ async function overrideTscJs(tscJsPath: string, version: string) {
7663
tryReplace(
7764
/function createProgram\(.+\) {/,
7865
(s: string) =>
79-
s + ` return require(${JSON.stringify(proxyApiPath)}).${createProgramFunction}(...arguments);`
66+
s + ` return require(${JSON.stringify(proxyApiPath)}).createProgram(...arguments);`
8067
)
8168

8269
// patches logic for checking root file extension in build program for incremental builds

0 commit comments

Comments
 (0)