【发布时间】:2016-06-06 12:48:08
【问题描述】:
我正在将所有文件的 ts 版本构建到一个文件中并尝试使用它。但它不适用于那个。正常的工作。这是 tsconfig:
"compilerOptions": {
"target": "ES5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"declaration": true,
"outDir":"client/build/",
"outFile": "all.js"
},
html加载all.js和系统导入。
<script src="client/build/all.js"></script>
<!-- 2. Configure SystemJS and Import -->
<script>
System.config({
packages: {
client: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('client/build/all')
.then(null, console.error.bind(console));
</script>
构建发生但无法加载到 index.html 文件中。还需要什么才能使其正常工作?其次是否有 tsc 的缩小? 注意:已检查Typescript compile to single file
更新
刚刚升级到 Typescript 1.9dev 并出现错误:
[0] node_modules/angular2/src/facade/promise.d.ts(1,10):错误 TS2661:无法重新导出模块中未定义的名称。 [0] client/services/httpprovider.ts(13,5): error TS4053: Return type of public method from export class has or is using name 'Observable' from external module "c:/git/projects/edureka/yeo/ 2/node_modules/rxjs/Observable”但不能命名。
更新:现在是 1.82 稳定版。
更新更新:使用捆绑配置定义(检查 Sasxa 的 cmets)-https://github.com/systemjs/systemjs/blob/master/docs/production-workflows.md
【问题讨论】:
-
任何具体的错误信息?
-
没有错误信息。 TS 1.5.3
-
不确定发生了什么,你得到一个 404 loading all.js ?构建文件夹中的 all.js 文件是否存在?控制台上的任何错误最好在此处发布。试试 Typescript 1.8,因为它具有捆绑功能和稳定版本 -W github.com/Microsoft/TypeScript/wiki/… 你安装的 1.9.dev 很可能有各种陷阱,因为它是一个 alpha 版本
-
没有 404 错误。我能够加载文件并且文件是正确构建的。但是当我做 System.import('client/build/all') 它不起作用。得到一个构建错误,当我在没有构建到一个文件的情况下正常编译时不会发生。
标签: build typescript angular out tsc