【发布时间】:2017-01-19 03:14:05
【问题描述】:
我有以下代码:
index.html
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
<script src="test.js"></script
<script>
System.import('test.js')
.then(null, console.error.bind(console));
</script>
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"outFile": "test.js"
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
在我的项目的根目录中,我有一个名为“test.js”的 tsc 创建的“outFile” - 似乎所有组件、模块等都在 test.js 中正确连接,但应用程序没有t 加载除初始“正在加载...”之外的任何内容,并且在浏览器中访问 index.html 时没有控制台错误。'
还要注意初始index.html:
<body>
<rz-app>Loading...</rz-app>
</body>
所以我实际上只是在 html 页面上得到“正在加载...”。
我一直在用头撞墙,我知道这很简单......
Q那么,我做错了什么 - 如何在我的 html 中包含串联的 ts outFile?
【问题讨论】:
标签: typescript angular systemjs