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

Nuxt support #69

Open ozum opened 5 years ago

ozum commented 5 years ago

Is it possible to add nuxt support or TypeScript-Nuxt-Starter. I could not manage to use nuxt 2 with typescript successfully.

Many thanks.

riddla commented 5 years ago

@ozum: Which problems did you face? We are currently developing a TypeScript project with Nuxt 2 and might be able to help ...

ozum commented 5 years ago

Thanks @riddla: At first, I failed to create a working project which integrates vue-cli, nuxt 2, typescript, vuetify and bits and pieces. Later, I managed to create a project and working on it right now (Although it's base is not state of the art)

A clean project boilerplate or a tutorial with latest versions of nuxt 2 and typescript would help others and me when starting a new project.

(I didn't searched lately such a boilerplate or tutorial, it may be published since my original post)

riddla commented 5 years ago

I see. Our project is also far from being a clean boilerplate right now ...

We are currently following mostly https://github.com/nuxt-community/hackernews-nuxt-ts. The nuxt team is also referring to this example in their latest release. Should be a good example for a lot of cases.

ozum commented 5 years ago

https://github.com/nuxt-community/hackernews-nuxt-ts package.json has a package called nuxt-ts-edge which I didn't see before. It seems to be published by official nuxt team.

There isn't any readme on it's page, but I found a blog about it:

https://medium.com/haiiro-io/nuxt-js-and-typescript-as-of-jan-2019-4d8674a91815

Next Nuxt “2.4” supports TypeScript “naturally”

From Nuxt 2.4, the brand new nuxt-ts is released by Nuxt team. That nuxt-ts provides Nuxt.js core which works with TypeScript without any particular configuration (Excepting tsconfig.json) which we’ve been doing until today. We can use that by replacing nuxt with nuxt-ts on package.json

Do you have any experience with it and how to use it?

riddla commented 5 years ago

Yes, we are using nuxt-ts-edge. You basically use nuxt-ts instead of nuxt within your npm scripts:

  "scripts": {
    "dev": "nuxt-ts",
    "build": "nuxt-ts build",
    "start": "nuxt-ts start",
    "generate": "nuxt-ts generate"
  }

The package itself is officially provided from the nuxt team: https://github.com/nuxt/nuxt.js/tree/dev/distributions/nuxt-ts.

ozum commented 5 years ago

I'll give it a try, which probably solves my problem in the first post.