10

When getting started with nuxt 3, it creates TypeScript project by default. Is there a way to move to JavaScript?

I have tried:

  1. Rename nuxt.config.ts to nuxt.config.js
  2. delete tsconfig.json
  3. add jsconfig.json

Contents of nuxt.config.js

export default {
};

contents of package.json

{
  "private": true,
  "scripts": {
    "dev": "nuxi dev",
    "build": "nuxi build",
    "start": "node .output/server/index.mjs"
  },
  "devDependencies": {
    "nuxt3": "latest"
  }
}

Still the .nuxt folder creates TypeScript files

enter image description here

1
  • 1
    If you don't want to use TS, you can still write regular JS code inside of it. At the end, it will still generate .mjs files. Commented Oct 31, 2021 at 14:35

2 Answers 2

5

No, unfortunately in the current nuxt3 version (3.0.0-27268729.5b8e10f), there is no configuration to disable the output of those type declaration files.

While the generated .d.ts file are intended to help TypeScript developers, Nuxt does not require app source to be written in TypeScript. The .d.ts files should have no impact on your JavaScript development other than the slight delay in generating those files.

Sign up to request clarification or add additional context in comments.

Comments

5

You can add in file tsconfig.json:

{
  "extends": "./.nuxt/tsconfig.json",
  "compilerOptions": {
    "allowJs": true
  }
}

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.