【发布时间】: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