Skip to content
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

Vite uses esbuild internally which lacks decorator support #4

Closed
snnsnn opened this issue Dec 8, 2022 · 1 comment
Closed

Vite uses esbuild internally which lacks decorator support #4

snnsnn opened this issue Dec 8, 2022 · 1 comment

Comments

@snnsnn
Copy link

snnsnn commented Dec 8, 2022

I see you working on decorators and just wanted to let you know vite uses esbuild internally and consequently does not support decorators. Vite becoming the defacto devtool, this may pose a major hurdle for adoption.

evanw/esbuild#104

@mighdoll
Copy link
Collaborator

mighdoll commented Dec 8, 2022

That's a savvy thing to worry about, but I think we're ok.

Decorators work well using Typescript and esbuild and vite.
And @reactively decorated Typescript classes can be used seamlessly from Javascript.

If someone wants to write classes with reactive properties in Javascript using esbuild or vite, there are three options:

  1. configure esbuild to compile Javascript as Typescript (as @evanw suggests in the esbuild issue above.)
  2. manually add get/set accessors in your class backed by a hidden Reactive object. (That's all the decorator library does)
  3. build a convenience library to make get/set accessors in Javascript. (contributions welcome!)

@mighdoll mighdoll closed this as completed Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants