-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Vue compiler adds import of mergeModels from vue, while it is not exposed in typings. #10331
Comments
This is an issue with the rollup setup is essentially typechecking the generated code after template compilation - that code is not meant to be typechecked. The We 'strongly recommend using vue-tsc to generate type declarations instead: https://vuejs.org/guide/typescript/overview.html#overview
|
This is a wontfix. Like @LinusBorg said, type checking should only happen to user-authored source code, not transformed / generated code. |
Thank you both for the explanation. |
Use Vite (which is using Rollup under the hood) + @vitejs/plugin-vue If you have to stick to plain Rollup for some reason, you can use a Rollup plugin that only performs TS transpilation without type checking, e.g. https://www.npmjs.com/package/rollup-plugin-esbuild |
Thank you! We've switched now. 👍 |
Vue version
3.4.18
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-kp769z?file=README.txt
Steps to reproduce
npm run build
What is expected?
Successful generation of ts/d.ts files.
What is actually happening?
[!] (plugin rpt2) RollupError: src/MyComponent.vue?vue&type=script&setup=true&lang.ts:1:33 - error TS2305: Module '"vue"' has no exported member 'mergeModels'.
1 import { useModel as _useModel, mergeModels as _mergeModels, defineComponent as _defineComponent } from 'vue'
~~~~~~~~~~~
src/MyComponent.vue?vue&type=script&setup=true&lang.ts
System Info
Any additional comments?
Seems to happen with rollup library setup (see repro), in SFC when both defineProps and defineModel are present.
Comment out defineProps and remove :id attribute on input element to make build pass.
The text was updated successfully, but these errors were encountered: