nativescript-vue / vue-cli-plugin-nativescript-vue

A vue cli 3.x plugin for NativeScript-Vue
MIT License
138 stars 27 forks source link

is babel dependency required? #29

Open fei4xu opened 5 years ago

fei4xu commented 5 years ago

Hi,

I was trying to create a vue+typescript+nativescript web+native project combo.

I run vue create dao-ts first, uncheck babel/linter, check typescript, kept all following default settings. So this is a purely typescript vue project with dependencies below:

  "dependencies": {
    "vue": "^2.6.10",
    "vue-class-component": "^7.0.2",
    "vue-property-decorator": "^8.1.0"
  },
  "devDependencies": {
    "@vue/cli-plugin-typescript": "^3.11.0",
    "@vue/cli-service": "^3.11.0",
    "typescript": "^3.4.3",
    "vue-template-compiler": "^2.6.10"
  }

Then I run vue add vue-cli-plugin-nativescript-vue with all default settings, then run tns migrate, then I run 'npm run serve:android' but got this error:

ERROR in ./components/HelloWorld.vue?vue&type=script&lang=ts& (../node_modules/ts-loader??ref--10-0!../node_modules/vue-loader/lib??vue-loader-options!../node_modules/string-replace-loader??ref--13-1!./components/HelloWorld.vue?vue&type=script&lang=ts&)
Module not found: Error: Can't resolve 'babel-loader' in 'D:\Projects\dao-ts\src'
 @ ./components/HelloWorld.vue?vue&type=script&lang=ts& (../node_modules/ts-loader??ref--10-0!../node_modules/vue-loader/lib??vue-loader-options!../node_modules/string-replace-loader??ref--13-1!./components/HelloWorld.vue?vue&type=script&lang=ts&) 2:0-62 9:8-12 12:8-17 17:2-5
 @ ./components/HelloWorld.vue?vue&type=script&lang=ts&
 @ ./components/HelloWorld.vue
 @ ../node_modules/ts-loader??ref--10-0!../node_modules/vue-loader/lib??vue-loader-options!../node_modules/string-replace-loader??ref--13-1!./App.vue?vue&type=script&lang=ts&
 @ ./App.vue?vue&type=script&lang=ts&
 @ ./App.vue
 @ ./main.native.ts
 @ multi ./main.native

it seems that babel-loader is required, but I guess when I created the vue web project, it's sure to be able to run without babel.

fei4xu commented 5 years ago

I'm sure I can create a nativescript + typescript (without babel) project too, so:

nativescript + typescript (without babel), ok vue + typescript (without babel), ok

then

nativescript + vue + typescript (without babel), ??

jawa-the-hutt commented 5 years ago

I've just released 0.2.0 of the plugin to npm. This includes NS 6.1.0 and NS-Vue 2.4.0. Try it again and let me know if this addresses things.

The vue cli generator is set to only install babel-loader if it detects Babel as part of the original Vue project. I'm wondering if the tns migrate caused an issue? Not sure. Try 0.2.0 of this plugin and see if this fixes the overall issue you had with getting a project up and going.

fei4xu commented 5 years ago

I'm sorry but I have the same error:

ERROR in ./components/HelloWorld.vue?vue&type=script&lang=ts& (../node_modules/ts-loader??ref--10-0!../node_modules/vue-loader/lib??vue-loader-options!../node_modules/string-replace-loader??ref--13-1!./components/HelloWorld.vue?vue&type=script&lang=ts&)
Module not found: Error: Can't resolve 'babel-loader' in 'D:\Projects\dao-ts\src'
 @ ./components/HelloWorld.vue?vue&type=script&lang=ts& (../node_modules/ts-loader??ref--10-0!../node_modules/vue-loader/lib??vue-loader-options!../node_modules/string-replace-loader??ref--13-1!./components/HelloWorld.vue?vue&type=script&lang=ts&) 2:0-62 9:8-12 12:8-17 17:2-5
 @ ./components/HelloWorld.vue?vue&type=script&lang=ts&
 @ ./components/HelloWorld.vue
 @ ../node_modules/ts-loader??ref--10-0!../node_modules/vue-loader/lib??vue-loader-options!../node_modules/string-replace-loader??ref--13-1!./App.vue?vue&type=script&lang=ts&
 @ ./App.vue?vue&type=script&lang=ts&
 @ ./App.vue
 @ ./main.native.ts
 @ multi ./main.native

it seems that ts-loader uses vue-loader then uses babel-loader, I will confirm in a nativescript only android app whether babel-loader is used.