Akshay Vijay Jain
Akshay Vijay Jain

Reputation: 15985

Transforming const to the configured target environment ("es5") is not supported yet when using vite

this is my tsconfig for a react project built without create-react-app

{
  "compilerOptions": {
    "target": "es5",
    "outDir": "lib",
    "lib": ["dom", "dom.iterable", "esnext"],
    "declaration": true,
    "declarationDir": "lib",
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx"
  },
  "include": ["src"],
  "exclude": ["node_modules", "lib"],
  "references": [{ "path": "./tsconfig.vite.json" }]
}

I am getting above error while running command vite which is supposed to spin up a dev server

Upvotes: 2

Views: 4805

Answers (1)

Akshay Vijay Jain
Akshay Vijay Jain

Reputation: 15985

Solution is to update es5 to ES2015.

{
...
"target":"ES2015",
...
}

Upvotes: 1

Related Questions