Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving nuxt 3 to JavaScript from TypeScript

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

like image 681
Adarsh Madrecha Avatar asked Apr 28 '26 02:04

Adarsh Madrecha


2 Answers

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.

like image 137
tony19 Avatar answered Apr 29 '26 14:04

tony19


You can add in file tsconfig.json:

{
  "extends": "./.nuxt/tsconfig.json",
  "compilerOptions": {
    "allowJs": true
  }
}
like image 20
Asep Suryana Avatar answered Apr 29 '26 15:04

Asep Suryana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!