How to make vitejs compile class private fields to legacy code?

160 Views Asked by At

I am using vitejs and typescript and I want to set the compile target to es2016, but it seems that, the class private fields aren't be compiled.

class Task {
   #prepare() { // here should be compiled.
   }
}

I tried to set build.target in vite.config.js and compilerOptions.target in tsconfig and it doesn't work.

@vitejs/plugin-legacy doesn't transform the code either.

0

There are 0 best solutions below