Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require(...).loadTsLib is not a function #222

Closed
2 tasks done
eleven-net-cn opened this issue Feb 16, 2023 · 7 comments · Fixed by #223
Closed
2 tasks done

require(...).loadTsLib is not a function #222

eleven-net-cn opened this issue Feb 16, 2023 · 7 comments · Fixed by #223

Comments

@eleven-net-cn
Copy link

Describe the bug

TypeError [Error]: require(...).loadTsLib is not a function
     at /Users/xxx/node_modules/vite-plugin-checker/dist/cjs/checkers/vueTsc/typescript-vue-tsc/lib/tsc.js:3505:105

If vue-tsc@1.1.0 is used, the error above will occur.

It works fine when reverting to vue-tsc@1.0.24.

Reproduction

vite-plugin-checker v0.5.5
vue-tsc v1.1.0

Expected behavior

vite-plugin-checker may need some optimization changes.

System Info

--

Additional context

No response

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@jelledv49
Copy link

Just encountered the same issue. Reverting to 1.0.24 indeed works

@johannschopplich
Copy link

Same issue here since vue-tsc v1.1.0.

@johnsoncodehk
Copy link

Just removing this line can fix:

tryReplace(/ = tracingEnabled\./g, ` = require(${JSON.stringify(proxyApiPath)}).loadTsLib().`)

@fi3ework Does vite-plugin-checker have to maintain this code by itself?

@fi3ework
Copy link
Owner

@johnsoncodehk Thanks for the help. I didn't know the usage clearly so I copied it from https://github.com/vuejs/language-tools/blob/master/packages/vue-tsc/bin/vue-tsc.js before. I'll remove this line soon and release a patch version.

I think for now vite-plugin-checker has to maintain by itself because the code to replace is not in a JSON or exported variable nowadays in bin/vue-tsc.js 👀. Do you think making the replacement operation exportable to other packages is a good idea?

@fi3ework
Copy link
Owner

I think there's also something broken in vue-tsc@^1.1.0(see vuejs/language-tools#2403). Use older version before vite-plugin-checker and vue-tsc are all good after 1.1.0.

@fi3ework
Copy link
Owner

fi3ework commented Feb 18, 2023

vue-tsc@^1.1.3 and vite-plugin-checker@^0.5.6 can work together fine now.

@johnsoncodehk
Copy link

I think for now vite-plugin-checker has to maintain by itself because the code to replace is not in a JSON or exported variable nowadays in bin/vue-tsc.js 👀. Do you think making the replacement operation exportable to other packages is a good idea?

Yes, I will see how to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants