-
Notifications
You must be signed in to change notification settings - Fork 104
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
Example for preset-typescript with vue-cli and potential fix #122
Conversation
Thanks for looking into this @graup! Any idea why babel is failing? Does this code first run babel on the user's code and THEN run typescript on the output? I know this is already a fallback, but if we want people to switch to babel, I'd suggest only add this if WDYT? cc @Aaron-Pool @mrmckeb |
I'm not sure. As far as I understand, the webpack chain is: (.vue) vue-loader -> (.ts) ts-loader -> (.js) babel-loader This seems to go back to the issue that @mrmckeb was fighting – maybe there just isn't any sensible way to use Vue's SCF without ts-loader :/ /edit: on the other hand, vue class components docs say that it should be possible to use it with only babel... |
OK, I'm cool with that:
Having both loaders running in React will be confusing and possibly problematic. |
Sorry guys, I checked out for a few days. I'll chat to @shilman on this and get back to you ASAP. Sorry, we did try to verify that this was working with Vue, but apparently didn't test thoroughly enough. |
edit: I just realized that this isn't merged. So what's the status on this ? Thanks. |
Btws, the readme still describes that you can pass a ts-loader config object even though it appears that ts-loader was removed in a prior PR but is being proposed to be brought back in this PR. |
SGTM. Closing! |
I added another example, which is very close to what vue-cli produces when you initialize a new project with typescript and babel. It doesn't work with the current version (3.0.0) – see #121
While digging around, it seems the babel-loader doesn't apply the custom babel config correctly (which in this case is needed for the class properties and decorators), or it does so at the wrong time, or something.
From the previous version, I salvaged the code that added ts-loader, and sure enough, that works. I added this code back in for testing. Ideally, we don't need it, but if we can't find another solution, this may be the easiest fix.
/edit: when using
@vue/cli-plugin-babel/preset
, you don't needbabel-preset-typescript-vue
anymore, but we should probably leave it in for folks who don't have their own babel config. It doesn't seem to conflict.