【问题标题】:serve angular app using angular-cli使用 angular-cli 提供 Angular 应用程序
【发布时间】:2017-12-17 21:59:24
【问题描述】:

我已经使用 angular-cli 创建了一个 Angular 2 应用程序,但是当我尝试使用 ng-serve 为该应用程序提供服务时,我遇到了以下错误:

 vendor.bundle.js net::ERR_CONTENT_LENGTH_MISMATCH
bootstrap 195fcde…:54 Uncaught TypeError: Cannot read property 'call' of undefined
    at __webpack_require__ (bootstrap 195fcde…:54)
    at Object.2 (main.ts:11)
    at __webpack_require__ (bootstrap 195fcde…:54)
    at webpackJsonpCallback (bootstrap 195fcde…:25)
    at main.bundle.js:1

我确实注意到 vendor.bundle.js 太大:这就是它无法在浏览器中加载的原因。那么,如何在开发环境中进行优化呢? N.B.:我没有更改我的应用程序的任何代码行,它是一个全新安装的 hello-world 应用程序。

【问题讨论】:

  • 你的 cli 版本是什么?
  • 角cli 1.2.0
  • 你能清除浏览器缓存并尝试猜测一下,不确定它是否是一个新项目,为什么会出现这个错误
  • 你能在这里添加你的 package.json 吗?

标签: angular typescript webpack angular-cli


【解决方案1】:

使用最新版本的 Angular cli。这个问题已经解决了。

详情请阅读以下链接

https://github.com/civetweb/civetweb/issues/422

【讨论】:

    猜你喜欢
    • 2017-11-17
    • 2014-01-21
    • 1970-01-01
    • 2016-09-17
    • 2018-09-24
    • 1970-01-01
    • 1970-01-01
    • 2015-12-15
    • 2019-02-13
    相关资源
    最近更新 更多