由于角度2 rc.6的变化,jspm捆绑不再有效

时间:2016-09-16 15:58:05

标签: angular jspm

由于角度2 rc.6捆绑的变化不再有效! 从rc.6中的变化可以看出: https://github.com/angular/angular/blob/master/CHANGELOG.md

即使在更改日志中,如果现在使用systemjs,这也是一大堆引用的重大改进。结果,我们再也无法使用命令:

jspm bundle src/App.js ./dist/index.js --minify --skip-source-maps

因为这会导致以下错误:

[08:40:33] 'x_bundle' errored after 18 s
[08:40:33] Error: Command `jspm bundle src/App.js ./dist/index.js --minify --skip-source-maps` failed with exit code 1
    at ChildProcess.exithandler (child_process.js:206:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Command `jspm bundle src/App.js ./dist/index.js --minify --skip-source-maps` failed with exit code 1
[08:40:33] 'production' errored after 31 s
[08:40:33] Error in plugin 'run-sequence(x_bundle)'
Message:
    Command `jspm bundle src/App.js ./dist/index.js --minify --skip-source-maps` failed with exit code 1
Details:
    killed: false
    code: 1
    signal: null
    cmd: jspm bundle src/App.js ./dist/index.js --minify --skip-source-maps
    stdout:      Building the bundle tree for src/App.js...

    stderr:
err  Error: SyntaxError: Unexpected token: string (./src/platform-browser-dynamic) (line: 2345, col: 16, pos: 104806)

Error
    at new JS_Parse_Error (eval at <anonymous> (C:\Users\root\AppData\Roaming\npm\node_modules\jspm\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:1545:18)
    at js_error (eval at <anonymous> (C:\Users\root\AppData\Roaming\npm\node_modules\jspm\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:1553:11)
    at croak (eval at <anonymous> (C:\Users\root\AppData\Roaming\npm\node_modules\jspm\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:2092:9)
    at token_error (eval at <anonymous> (C:\Users\root\AppData\Roaming\npm\node_modules\jspm\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:2100:9)
    at unexpected (eval at <anonymous> (C:\Users\root\AppData\Roaming\npm\node_modules\jspm\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:2106:9)
    at semicolon (eval at <anonymous> (C:\Users\root\AppData\Roaming\npm\node_modules\jspm\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:2126:56)
    at simple_statement (eval at <anonymous> (C:\Users\root\AppData\Roaming\npm\node_modules\jspm\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:2317:73)
    at eval (eval at <anonymous> (C:\Users\root\AppData\Roaming\npm\node_modules\jspm\node_modules\uglify-js\tools\node.js:28:1), <anonymous>:2186:19)

让我补充一点,这是/ src / platform-b​​rowser-dynamic中的失败线export * from './src/platform-browser-dynamic';

由于ng2 rc.6的工作方式,现在几乎就像现在缩小了一样,但我不确定是否有这么多活动部件...

这在rc.6之前完美无缺。

我希望团队成员可以提供协助,因为我们无法进行制作,直到我们解决这个问题,

问候

肖恩。

2 个答案:

答案 0 :(得分:1)

我遇到了同样的问题。在我的头撞墙几天后,我终于将我的jspm升级到了0.17。然后代替捆绑使用

style={{width:'300px'}}

之后一切都应该按预期工作。如果您运行的是打字稿版本1.8.34,则此解决方案将起作用。

答案 1 :(得分: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

希望它可以帮助某人

肖恩