I want to build a complete fullstack web app. My server side code is in typescript. I would like to configure my project such that it will be from the following structre:
- projectFolder/src/(server-side typescript files) - contians an index.ts main file
projectFolder/public/(client-side code) - served from index.ts express code.
projectFolder/serverCodeBundle.js
While I am working on my server side code I want some watch command to run in the backgorund and bundle all my ts files to some serverCodeBundle.js such that it would be sourcemapped to original ts files.
To keep things simple let's assume my server-side code looks like this(for simplicity I have ommited client code serving):
/src/index.ts:
import {A} from './A'
new A()
/src/A.ts:
export class A {
constructor() {
throw new Error("A error")
}
}
Running nodemon serverCodeBundle.js an error message should appear specifying the error come from A.ts.
I have tried tsify[together with require("source-map-support").install() in the beginning of each ts file(and in index.ts only too) and sourcemap option on in tsconfig] but couldn't get it to work.
Is there any tsify configuration, yeoman generator or any other bundler which can do that?