[英]Due to changes in angular 2 rc.6 jspm bundling no longer works
由于角度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)
让我补充一点,这是export * from './src/platform-browser-dynamic';
失败的行export * from './src/platform-browser-dynamic';
在/ src / platform-browser-dynamic中
由于ng2 rc.6的工作原理,现在好像缩小失败了,但是我不确定,因为活动部件太多了...
这在rc.6之前完美运行
我希望团队中的某人可以提供帮助,因为在解决此问题之前我们无法投入生产,
问候
肖恩
我有同样的问题。 经过数天的敲击,我终于将jspm升级到0.17。 然后代替捆绑使用
jspm build src/App.js ./dist/index.js --minify --skip-source-maps
在那之后,一切都会按预期进行。 如果您正在运行打字稿版本1.8.34,则此解决方案将起作用。
在花了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" } ...
我不知道ng2在rc.6之前有什么变化,这需要进行此移除。在这里,您可以修复它,现在我可以运行了:
jspm bundle app/main ./dist/index.js --minify --skip-source-maps
希望它可以帮助某人
肖恩
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.