fathyb / parcel-plugin-typescript

🚨 Enhanced TypeScript support for Parcel
MIT License
180 stars 18 forks source link

Vue support #35

Open rzane opened 6 years ago

rzane commented 6 years ago

Official Vue support was added to parcel today. I was hoping that maybe I could use this plugin with a Vue SFC, but that doesn't appear to work as expected.

Here's a repro:

https://gist.github.com/rzane/f7201b93df6d5d2d49269becf53f9f00

Here's the error that gets thrown:

$ yarn parcel App.vue
Server running at http://localhost:1234
✨  Built in 845ms.
Unhandled promise rejection: Error: Error: Error: Could not find file: '/Users/rzane/Workspace/repro/App.vue'.
    at getValidSourceFile (/Users/rzane/Workspace/repro/node_modules/typescript/lib/typescript.js:103059:23)
    at Object.getSemanticDiagnostics (/Users/rzane/Workspace/repro/node_modules/typescript/lib/typescript.js:103238:36)
    at LanguageService.check (/Users/rzane/Workspace/repro/node_modules/parcel-plugin-typescript/build/backend/service/index.js:16:24)
    at Object.<anonymous> (/Users/rzane/Workspace/repro/node_modules/parcel-plugin-typescript/build/backend/worker/launcher.js:34:28)

Would it be possible to support this?

fathyb commented 6 years ago

The only technical problem I see with Vue.js is type-checking, is there any project in the wild using Vue SFCs with TypeScript and type-checking? It could be pretty hard to implement the Vue parser into TypeScript file host.

If you don't want type-checking you can use transpileOnly to still keep features like path renaming.

danielegarciav commented 5 years ago

The only technical problem I see with Vue.js is type-checking, is there any project in the wild using Vue SFCs with TypeScript and type-checking?

Yes there are. I have a couple projects using Vue SFCs with TypeScript + types shared across all projects. VS Code is able to catch TypeScript errors in .vue files through Vetur, but Parcel will happily build the project without any errors or warnings.

I can't just use tsc --noEmit since it doesn't read .vue files. Is there any chance Vue SFCs could get any support?