Angular-cli 不使用 --dev 选项生成打字稿文件 [英] Angular-cli not generating typescript files with --dev option

查看:26
本文介绍了Angular-cli 不使用 --dev 选项生成打字稿文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 angular-cli:1.0.0-beta.14,节点:6.6.0,操作系统:win32 x64.当然,这是 angular-cli 的 webpack 版本.我可以使用 ng build.ng 构建输出给出了这个 webpack 版本:webpack 2.1.0-beta.22.

我想知道为什么当我运行 ng build --dev 时没有捆绑 TypeScript 文件.我得到了 js 文件和源映射(不幸的是 Chrome 窒息了 - 我无法解析 SourceMap).我认为对于 DEV 部署,除了源映射之外,我还会获得我开发的打字稿文件.是否有一些关于 ng build 使用的选项的文档?

解决方案

在此处查看@vt5491 的详细回答:

<小时>

另外,我相信它只是带有一个 -ng b -dev.在此处查看 ng 帮助:

<预><代码>...ng build <选项...>构建您的应用程序并将其放入输出路径(默认为 dist/).别名:b--target(字符串)(默认值:开发)别名:-t 、-dev (--target=development)、-prod (--target=production)...

<小时>

我们有一个类似的问题,将样式全部放入 index.html<style> 标签中.见:

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?

解决方案

See @vt5491's detailed answer here:


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:

这篇关于Angular-cli 不使用 --dev 选项生成打字稿文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆