nuxt / create-nuxt-app

Create Nuxt.js App in seconds.
MIT License
3.49k stars 429 forks source link

TypeScript: Create nuxt.config.ts instead nuxt.config.js #470

Open munierujp opened 4 years ago

munierujp commented 4 years ago

@nuxt/types package provides type definition for Nuxt configuration.

Configuration (Runtime) | Nuxt TypeScript

I think that project with TypeScript should use nuxt.config.ts instead nuxt.config.js.

fabiofdsantos commented 4 years ago

I also have these related errors:

  61:13  error  'config' is defined but never used. Allowed unused args must match /^_/u  @typescript-eslint/no-unused-vars
  61:21  error  'ctx' is defined but never used. Allowed unused args must match /^_/u     @typescript-eslint/no-unused-vars
climba03003 commented 4 years ago

When you are having server like Express or Koa (Others, I am not using). Replacing nuxt.config.js to nuxt.config.ts will cause a lot of inconvenience.

For example, after compiling server/index.ts to server/index.js. It cannot read nuxt.config.ts file.

fabiofdsantos commented 4 years ago

@climba03003 So, at least .ts should be created by default for SPA mode.

pi0 commented 4 years ago

/cc @kevinmarrec

kevinmarrec commented 4 years ago

The following PR : https://github.com/nuxt/create-nuxt-app/pull/449 will do it and fix lint issues.

FYI : nuxt.config.ts is not mandatory for a Nuxt TypeScript project, as well as @nuxt/typecript-runtime being optional.