adachishohei / nuxt-ts-app

0 stars 0 forks source link

nuxt-property-decoraterが使えない>< #1

Open adachishohei opened 5 years ago

adachishohei commented 5 years ago

やったこと

yarn create nuxt-app nuxt-ts-app
  Axios
  ESLint
  Prettier
  jsconfig.jsonを選択

yarn add -D @nuxt/typescript
yarn add ts-node

touch tsconfig.json

yarn add nuxt-property-decorator

nuxt-config.js -> nuxt-config.tsへリネーム

nuxt-config.tsに以下を追記

  build: {
    babel: {
      plugins: [
        ["@babel/plugin-proposal-decorators", { legacy: true }],
        ["@babel/plugin-proposal-class-properties", { loose: true }]
      ]
    }
  }

参考記事

https://ja.nuxtjs.org/guide/typescript

https://github.com/nuxt-community/nuxt-property-decorator

adachishohei commented 5 years ago

 ERROR  Failed to compile with 1 errors                                                                                   friendly-errors 17:39:48

 ERROR  in ./pages/index.vue?vue&type=script&lang=ts&                                                                     friendly-errors 17:39:48

Module parse failed: Unexpected character '@' (19:0)                                                                      friendly-errors 17:39:48
File was processed with these loaders:
 * ./node_modules/vue-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import Logo from '../components/Logo.vue'
| 
> @Component({
|   components: {
|     Logo
                                                                                                                          friendly-errors 17:39:48
 @ ./pages/index.vue?vue&type=script&lang=ts& 1:0-117 1:133-136 1:138-252 1:138-252
 @ ./pages/index.vue
 @ ./.nuxt/router.js
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi eventsource-polyfill webpack-hot-middleware/client?reload=true&timeout=30000&ansiColors=&overlayStyles=&name=client&path=/__webpack_hmr/client ./.nuxt/client.js