Reputation: 2936
I am working on a new project using .NET Core rc2
WebAPI and Angular2 rc1
using TypeScript
. Everything is setup and working well. .NET Core
only handles the API and Angular2
handles all views.
My ts
files are in a sub-folder script
of the root project folder because they need access to the node_modules
folder. In my tsconfig
I have an outDir
which points to wwwroot/app
. My ts
files are compiled into that folder, which then contains the js
and the js.map
files. However, they do not contain the ts
files themselves and as a result I cannot debug them in chrome or firebug.
Moving everything to the wwwroot/app
folder is not a solution as I would then also need to move node_modules
to wwwroot
which would result in a huge publish package.
I definitely want to run tsc
in watch mode with node.js
's lite-server
in watch mode as well. This setup speeds up development significantly and I don't want to miss that option.
I think what I need is a way to compile everything in my root/script
folder (the map
files need to point to the correct location of the ts
files) and then as a post-build process copy everything (ts, js and js.map
) into the wwwroot/app
folder.
Is it possible to run tsc
in watch mode with such a post build task that fires whenever one or more ts
files are compiled?
Any other solutions welcome.
Upvotes: 1
Views: 336
Reputation: 394
You could compile your Typescript using a node module and then create a watch task to check for updates in your files, using Grunt (grunt-typescrpit) or Gulp.
E.g: Automating TypeScript with Node And Grunt
Upvotes: 1