pawelgabryelewicz / babel-preset-typescript-vue

TypeScript preset for Babel 7.x supporting Vue.js components written in TS
MIT License
22 stars 4 forks source link

Support Vue 3 #10

Closed Coldsewoo closed 2 years ago

Coldsewoo commented 3 years ago

SInce vue-template-compiler no longer works in Vue3, this library has been replaced by corresponding @vue/compiler-sfc. I dont think it makes sense to merge this commit directly since then this preset will not work in Vue2 instead, but can you make it as different package for Vue3 with name of babel-preset-typescript-vue3 for example? All tests have been passed and I use this for my personal vue3 project without any error.

somodevo commented 3 years ago

Very nice! Can you help me how to use it in my local project? Adding this PR does not work because the modules are not build 🤔

Coldsewoo commented 3 years ago

@somodevo What I have done:

dependencies: vue 3.0.3, @vue/confiler-sfc 3.0.3

clone this repo and make changes (you can just clone my own repo HERE) Make sure to comment out rollup.config.js in .npmignore to work it properly.

commit, and push to your own repo, and change package version in package.json like below "babel-preset-typescript-vue": "https://github.com/Coldsewoo/babel-preset-typescript-vue.git",

plus, you will need to add postinstall in scripts, "postinstall": "cd ./node_modules/babel-preset-typescript-vue && npm install && npm run build"

now you can use your own package when npm install.

somodevo commented 3 years ago

Thanks you very much @Coldsewoo ! Works for me 🥇

Coldsewoo commented 3 years ago

Thanks you very much @Coldsewoo ! Works for me

I've published separate package for vuejs3 on npm

https://www.npmjs.com/package/babel-preset-typescript-vue3

Its revised version of this package and will be temporal until author came back.