-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
decorators not support in js for prebuild #2349
Comments
I believe this is because of how esbuild is leveraged.
I'm not sure if esbuild will compile decorators in a JS project since I discovered this in a TS project. |
Yes,esbuild dose not support decorator of javascript, it just support typescript. And vite when prebuild in But I hope vite can have a method to solve this issue, thanks |
Do you have Vite working with decorators or only esbuild? |
having this issue as well. Anyone has the solution for it? |
Closing as it's an esbuild issue evanw/esbuild#1392 Though, in my opinion, such usage should be discouraged. Decorators in JS is still a stage-2 proposal, so it's still subject to change in the future. Its current specification is drastically different from the TypeScript implementation, too, which might surprise many users. |
I would count this as a very smart workaround 🙂 |
Didn't you need any other change in |
Yes. Just use the official doc for vite.config.js. |
Describe the bug
运行
dev
时,因为有预购建,导致esbuild无法识别js中的decorators,报如下错误Reproduction
code 如下
yarn dev
PS.
yarn build
时,加入了babel插件且无预购建步骤,因此不会报错System Info
vite
version: 2.0.3Logs (Optional if provided reproduction)
yarn dev
The text was updated successfully, but these errors were encountered: