TypeScript: compiling removes unreferenced imports

陌路散爱 提交于 2019-11-30 04:15:48

A nicer solution (tested with TS 1.8):

import 'just/referencingthis/forpackaging';

The amd-dependency triple-slash-directive seems to only work if there are other require imports; only having amd-dependency directives results in the TypeScript compiler generating JavaScript completely without a module definition.

You can do this at the top of your file (instead of import):

/// <amd-dependency path="just/referencingthis/forpackaging" />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!