简体   繁体   English

角度2-未捕获的ReferenceError:未定义系统

[英]Angular 2 - Uncaught ReferenceError: System is not defined

I've used crunsh to minify my Angular2 app ( source code ) and it successfully produced app.js, index.html and style.css. 我使用crunsh缩小了Angular2应用程序( 源代码 ),并成功生成了app.js,index.html和style.css。

However, when I place those 3 files into a test folder on my domain: http://www.mortgagecalculator123.com/test/ it's not working. 但是,当我将这3个文件放入域中的测试文件夹中时: http : //www.mortgagecalculator123.com/test/,它不起作用。

I've inspected the page in Chrome and I am getting a following error: Uncaught ReferenceError: System is not defined (anonymous function). 我已经在Chrome中检查了该页面,但收到以下错误:Uncaught ReferenceError:未定义系统(匿名函数)。

Any idea what I am doing wrong? 知道我在做什么错吗? To me it seemed like Angular 2 is somehow not being included in index.html, so I added it it in like this: 在我看来,Angular 2似乎不包含在index.html中,因此我将其添加为:

<script src="https://code.angularjs.org/2.0.0-snapshot/angular2.js"></script>

But that only creates further errors. 但这只会造成更多错误。 It seems I am missing something and I am not sure what. 看来我缺少了一些东西,但我不确定。

Thanks... 谢谢...

you are in wrong! 你错了! angular 2 app use node_modules and very dependency. angular 2应用程序使用node_modules并且非常依赖。 you can not minify just one script! 您不能只缩小一个脚本! if you can minify your code and bundle it , please work with gulp or webpack. 如果您可以缩小代码并将其打包,请使用gulp或webpack。 read this for more details: Link 阅读此以获取更多详细信息: 链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM