3

We use this setting in development:

  • we develop our angular project in typescript using IntelliJ IDEA
  • transpile our typescript code to javascript with grunt-ts
  • concatenate all transpiled javascript files to one singe all.js file using grunt-contrib-concat
  • all.js file is referenced in html

The problem is that we run our app from concatenated all.js file so we can't debug it. Any ideas on how can we debug our source code in typescript? Is there any development-wise solution or advice to this?

Aviad P.
  • 32,036
  • 14
  • 103
  • 124
DMike
  • 31
  • 2
  • it is possible but you must let tsc concatenate the files. In the current version TypeScript that comes with some restrictions on how the code is written, in the @next version it works out of the box if you use amd or system packages. You can check the response to this question for more details http://stackoverflow.com/questions/34474651/typescript-compile-to-single-file – toskv Dec 28 '15 at 10:48
  • 2
    We use `gulp-typescript` plugin and for development purposes we reference all the `.js` files in `.html` page. Then I simply debug JS files through Google Chrome. It works for me very well. – MartyIX Dec 28 '15 at 13:00
  • 1
    You'll need to use sourcemaps. Add the `outFile` and `sourceMaps` options in `tsconfig` and get rid of grunt-concat. – Louay Alakkad Dec 28 '15 at 14:32
  • Are you compiling with `mode` set to "commonjs"? In any case using something like [grunt-browserify](https://www.npmjs.com/package/grunt-browserify) might be a good solution. – Nypan Dec 29 '15 at 16:33
  • Jetbrains explained it in here: https://www.jetbrains.com/webstorm/help/debugging-typescript.html – mrchad Feb 15 '16 at 21:30

0 Answers0