在最新的角度2,使用jspm,不能缩小捆绑

时间:2016-09-16 04:51:15

标签: angular uglifyjs jspm

关于最新的角度2,使用jspm,无法缩小捆绑...

收到错误

events.js:160
      throw er; // Unhandled 'error' event
      ^
GulpUglifyError: unable to minify JavaScript
    at createError (C:\msweb\studioDashboard\node_modules\gulp-uglify\lib\create-error.js:6:14)
    at wrapper (C:\msweb\studioDashboard\node_modules\lodash\_createHybrid.js:87:15)
    at trycatch (C:\msweb\studioDashboard\node_modules\gulp-uglify\minifier.js:26:12)

过去工作正常,最近更新到ng 2.0,

赞赏此信息

感谢,

肖恩。

1 个答案:

答案 0 :(得分:1)

花了2天试图用捆绑修复jspm后我终于能够修复它了,在jspm中你需要从包中删除以下语句: packages: { "@angular/common": { "main": "index.js", "defaultExtension": "js" }, "@angular/compiler": { "main": "index.js", "defaultExtension": "js" }, "@angular/core": { "main": "index.js", "defaultExtension": "js" }, "@angular/http": { "main": "index.js", "defaultExtension": "js" }, "@angular/platform-browser": { "main": "index.js", "defaultExtension": "js" }, "@angular/platform-browser-dynamic": { "main": "index.js", "defaultExtension": "js" }, "@angular/router": { "main": "index.js", "defaultExtension": "js" } ... 我不知道在rc.6之前ng2中有什么改变需要这个改造,但是你去了,这个修复它,现在我可以最终运行:

jspm bundle app/main ./dist/index.js --minify --skip-source-maps

希望它可以帮助某人

肖恩