简体   繁体   English

Typescript编译为单个文件外部模块

[英]Typescript compile to single file external modules

I'm trying to compile my project to a single js file and definition, however the compiler doesn't seem to do it correctly. 我正在尝试将项目编译为单个js文件和定义,但是编译器似乎无法正确执行。

example: node /home/ian/.m2/repository/com/williamsinteractive/oxygen/gdk-build/0.3.0-dirty/compile/tsc/1.3.0/tsc.js --out test.js -m amd -t ES5 -d Command.ts 例如:节点/home/ian/.m2/repository/com/williamsinteractive/oxygen/gdk-build/0.3.0-dirty/compile/tsc/1.3.0/tsc.js --out test.js -m amd- t ES5 -d Command.ts

A blank test.js and test.d.ts gets created with no code in them. 将创建一个空白的test.js和test.d.ts,其中没有代码。

Also a Command.js and a Command.d.ts get created with the code in them. 还使用其中的代码创建了Command.js和Command.d.ts。

I want to be able to compile all my classes into a single .js file and ideally a single .d.ts file as it is a library to be imported by other projects. 我希望能够将所有类编译成单个.js文件,理想情况下,将其编译成单个.d.ts文件,因为它是要由其他项目导入的库。

TypeScript doesn't support --out with external modules. TypeScript不支持--out与外部模块一起使用。 Luckily there are external tools that do a great job for this eg for amd recommend you look at r.js 幸运的是有,为了这个,例如,用于做大量的工作外部工具amd建议你看看r.js

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

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