microsoft / TypeScript-Vue-Starter

A starter template for TypeScript and Vue with a detailed README describing how to use the two together.
MIT License
4.45k stars 592 forks source link

Script with `lang="ts"` should be typescript-ed #3

Closed zigomir closed 7 years ago

zigomir commented 7 years ago

Otherwise build with .vue component files will fail.

msftclas commented 7 years ago

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request. Thanks, Microsoft Pull Request Bot

octref commented 7 years ago

This is already covered by https://github.com/TypeStrong/ts-loader#appendtssuffixto-regexp-default

zigomir commented 7 years ago

I see. My change is only needed when ExtractTextPlugin is used when you want to extract styles from SFC into separate .css file. It's a big gotcha, not really sure why it is happening.

DanielRosenwasser commented 7 years ago

@octref @HerringtonDarkholme any idea about whether this change sounds appropriate?

HerringtonDarkholme commented 7 years ago

I can reproduce building error if setting extractCSS to true. https://github.com/vuejs/vue-loader/blob/master/docs/en/configurations/extract-css.md

Hmm, it seems to be a bug in vue-loader though. I need some more investigation.

Update: it seems to be vue-loader's behavior. If extractCSS is true, it will consult css-loader if loaders[lang], in this case 'ts-loader', is not explicitly configured. https://github.com/vuejs/vue-loader/blob/master/lib/loader.js#L216-L218

HerringtonDarkholme commented 7 years ago

Fix has been released as 12.0.4.

DanielRosenwasser commented 7 years ago

@zigomir can you try out the latest ts-loader and see if that helps with the issue you ran into?

zigomir commented 7 years ago

Yes, this fixes it! Thanks @HerringtonDarkholme and @DanielRosenwasser!