Closed petrpatek closed 3 years ago
hey @petrpatek that's nice to have TS as first-class citizen in templates ❤️
there are a couple of things with the current approach:
/dist/src/something.js:73:11
, since most of the code usually goes into src
and main.js
being the entrypoint of the actor. using the start script as node -r ts-node/register/transpile-only src/main.ts
solves both of those issues, ts-node adds the sourcemap support out-of-the-box, but adds another 2 issues: bundle size and extra dependencies, and typescript dependency itself is 60MB, an extra second downloading through NPM. IMHO, for the SDK being a runtime, it's worth this dependency hassle. 😄
on the other hand, the side-by-side sourcemaps can be generated using tsconfig.json settings, but every change requires rebuilding, it's very easy to forget doing this when not using the watch mode, and as actors can't have a "hot module replacement" like React or Angular, tsc -w
isn't really suitable
@B4nan Can I merge it like this?
Let's see what others think, it looks good to me, and we can iterate on that before sdk v3 gets out.
@vladfrangu Thanks for catching this!
Created typescript template with the multistage build. Inspired by #7 and internal typescript projects.