embroider-build / app-blueprint

[pre-alpha™️] Blueprint for next generation of Ember apps
34 stars 11 forks source link

Need to disable vite's built-in TS support #85

Open ef4 opened 2 months ago

ef4 commented 2 months ago

Once we add a typescript option to the blueprint, we need to make sure that the vite.config.mjs includes:

  esbuild: {
    exclude: /\.m?ts$/,
  },

Without this, Vite's built-in TS transpiler will do the wrong thing before our babel config has a chance to run. We want to handle TS along with the rest of babel.

An example of "the wrong thing" is decorators. We want them to be handled by decorator-transforms in babel, not esbuild's typescript implementation. Another example is class fields: I've seen the TS implementation of class fields break ember-concurrency/async-arrow-task-transform.

tcjr commented 1 month ago

Thank you so much for this.

Every time I've tried to use vite, I would eventually hit an error saying ERROR: TypeScript experimental decorators can only be used with class declarations. This error was raised from the vite:esbuild plugin. Since (non-decorator) TypeScript generally "worked", I did not even consider that this was the route to go.