Angular-cli not generating typescript files with -

2019-09-16 12:17发布

问题:

Using angular-cli: 1.0.0-beta.14, node: 6.6.0, os: win32 x64. Of course, this is the webpack version of angular-cli. I'm able to use ng build. The ng build output gives this webpack Version: webpack 2.1.0-beta.22.

I'm wondering why the TypeScript files don't get bundled when I run ng build --dev. I get js files and sourcemaps (which unfortunately Chrome chokes on - I get Failed to parse SourceMap). I would think for a DEV deploy, in addition to source maps, I would get the typescript files I developed. Is there some documentation on the options to be used with ng build?

回答1:

See @vt5491's detailed answer here:

  • Typescript files not showing in Angular 2 CLI project using chrome web developer tools

Also, I beleive it's just ng b -dev with one -. See ng help here:

...

ng build <options...>
  Builds your app and places it into the output path (dist/ by default).
  aliases: b
  --target (String) (Default: development)
    aliases: -t <value>, -dev (--target=development), -prod (--target=production)

...

We have a similar issue with styles being all put into index.html's <style> tags. See:

  • How to Source Map Angular CLI css files in Chrome Dev Tools?