Typescript files not showing in Angular 2 CLI project using chrome web developer tools -
i have generated typescript project using angular2 cli (ember cli). using chromium web developer tools debug. have "enable javascript source maps" selected in developers tools settings. see .js files , .ts listed in sources view. however, .ts (typescript) files show empty when select them i.e can't find them.
screen print showing situation:
i can see text of .js files if select them.
the .ts files not copied dist directory, , seems problem me, i've seen examples elsewhere showing typical angular2 cli dist structures , not have .ts files either.
relevant portion of "tsconfig.json" showing have source mapping enabled:
1 "compileonsave": false, 2 "compileroptions": { 3 "declaration": false, 4 "emitdecoratormetadata": true, 5 "experimentaldecorators": true, 6 "maproot": "", 7 "module": "system", 8 "moduleresolution": "node", 9 "noemitonerror": true, 10 "noimplicitany": false, 11 "outdir": "../dist/", 12 "rootdir": ".", 13 "sourcemap": true, 14 "sourceroot": "/", 15 "target": "es5" 16 },
js.map files are produced , reside in dist directory next .js files.
example mapping file (portion):
{"version":3,"file":"app.js","sourceroot":"/","sources":["app.ts"],"names":[],"mappings":";;;;;;;;;;;;;yaga,mb
i've tried:
1) copying .ts files src dist.
2) various attempts @ editing app.js.map file manually e.g sourceroot , sources.
it's not quite clear "/" referring in js.map file: project's src dir or dist dir? if edit .js.map file have refresh browser pick on it?
i think basic problem it's looking ts files in src dir, , outside reach of browser (since it's located @ "../src").
chromium shows path ts file "http://localhost:4202/app/cpp-scenes.ts". when put .ts file there, no dice.
i don't know if js mapping problem, angular 2 problem, angular2 cli problem, or typescript problem.
it's real pain when console says "error in line 52 in blah.ts", can't jump there , put in breakpoint etc.
has else had luck getting source mapping working in angular2 cli project?
i able work. have to add angular cli src folder workspace, , have "map network resource" on 1 of .ts files.
note: example assumes case client , server running on same machine. if have situation client on windows machine, server running on linux example, on client machine have mount linux server source directory windows share , specify like
\\192.168.1.134\myshare\myproject\src\client
as workspace folder.
i had this, , while it's little more complicated, fundamentally works same local case
i took screen shots of entire process, it's easiest show these.
- select 1 of ts files resides under dist directory (that corresponds directory ng serve serving from), , select "add folder workspace":
say "allow" subsequent prompt allowing dev tools access src dir:
observe src folder listed under dev tools sources. can browse ts files (not 1 added), breakpoints set won't take effect until "establish mapping":
select appropriate mapping , click on enable
now can set breakpoint in .ts file , drill down on error messages .ts source.
the basic trick have add source ts file directory chrome manually, since files not under serving directory. mapping stays in effect until either manually remove (by right-clicking on .ts file , selecting "remove network mapping") or until close browser (it retain mapping on refreshes however)