Skip to content

Support Vue 3 #384

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

Closed
jods4 opened this issue Feb 12, 2020 · 9 comments
Closed

Support Vue 3 #384

jods4 opened this issue Feb 12, 2020 · 9 comments

Comments

@jods4
Copy link

jods4 commented Feb 12, 2020

Feature description

Vue 3 is now publicly available in alpha.
Because of changes in its internal structure, tools like fork-ts-checker-webpack-plugin need to be updated (see below).

Feature implementation

I'm using Vue 3 + Webpack + Typescript in my project.
This requires [email protected], [email protected] and @vue/[email protected].

When I try to use vue: true in fork-ts-checker-webpack-plugin I get the following error:

INTERNAL ERROR: When you use `vue` option, make sure to install `vue-template-compiler`.

I'm pretty sure this is because Vue 3 uses @vue/compiler-sfc to compile views instead of vue-template-compiler and the checker needs to be updated to use this package when it's available instead of the old one.

@johnnyreilly
Copy link
Member

If you'd like to work on this that would be greatly appreciated. I'm not a Vue user and I believe none of the other maintainers are either.

If someone would like to submit a PR that would be greatly appreciated. It's important that we maintain support for Vue 2 for now as well. Thanks!

@piotr-oles
Copy link
Collaborator

Did you try the following settings?

vue: {
  enabled: true,
  compiler: '@vue/compiler-sfc'
}

@jods4
Copy link
Author

jods4 commented Feb 12, 2020

@piotr-oles I did not, I'll try tomorrow!
Should it work? If the packages share the same interfaces it might (and it would also be rather easy to fix out-of-the-box)

@jods4
Copy link
Author

jods4 commented Feb 13, 2020

Quick update: it doesn't work.

Unfortunately the exported api has changed just a little bit.

I have not tested yet but changing this line:
https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/blob/master/src/VueProgram.ts#L321

to

 const { descriptor: { script } } = parser.parse(content, {
      pad: 'space'
    });

might work.

@jods4
Copy link
Author

jods4 commented Feb 14, 2020

PR available in #389

@piotr-oles
Copy link
Collaborator

🎉 This issue has been resolved in version 5.0.0-alpha.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

@jods4
Copy link
Author

jods4 commented May 27, 2020

Tested with 5.0.0-alpha.9 it works great!
(after fiddling with the 5.0 config changes)

Note to anyone else finding this with Google:
The correct compiler (Vue 2 vs 3) is not automatically detected, be sure to explicitly configure it in fork-ts-checker options:

vue: {
  enabled: true,
  compiler: '@vue/compiler-sfc'
}

@piotr-oles
Copy link
Collaborator

🎉 This issue has been resolved in version 5.0.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@piotr-oles
Copy link
Collaborator

🎉 This issue has been resolved in version 5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

3 participants