I'm trying to get Angular to run in a Rails 6 project. I have installed the jsbundling-rails (with esbuild) and typescript-rails gems to load my JavaScript and TypeScript files. What should happen is that I write some TS, then typescript-rails transpiles it to JS, then esbuild bundles it all up and jsbundling-rails runs it on the Rails application.
This sort of works, but not when I use a TypeScript decorator like @NgModule
. It gets transpiled to JS alright, but then it doesn't run because I get an Invalid or unexpected token
error at the @ sign. I tried putting the --experimentalDecorators
flag in the typescript-rails config, but it did not help.
Is this happening because the typescript-rails gem is turning (standard) TS decorators into (unsupported) JS decorators? Should I get rid of typescript-rails (I couldn't get the TS to run until I installed it)? Can I make the JS compiler support decorators?