[英]Default export as global variable Typescript 1.8 --module UMD
I am writing an NPM module that exports a single file. 我正在编写一个导出单个文件的NPM模块。 I have set the
--module
flag to umd
. 我已经将
--module
标志设置为umd
。 I would like to expose the default export of this file as a global variable. 我想将此文件的默认导出显示为全局变量。
Is it possible to export a UMD module as a global variable in Typescript 1.8? 是否可以将Type Type 1.8中的UMD模块导出为全局变量?
One strategy is to restructure your module as a namespace so that it acts as a global, and add a custom build step which adds an export default yourNameSpace;
一种策略是将模块重构为名称空间,以便其充当全局名称,并添加自定义构建步骤,该步骤将添加
export default yourNameSpace;
to your file to create a modular version. 到您的文件以创建模块化版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.