如何从1个包中添加多个模块

时间:2017-02-20 09:19:33

标签: typescript module aurelia aurelia-cli

我想从包string-template导入2个模块。 Type:=xlTextString, String:="FALSE", TextOperator:=xlContains 包含2个文件string-template& index.js都导出模块。

我尝试使用以下方法完成此操作:

1)将两个模块添加到compile.js中的vendor-bundle个依赖项:

aurelia.json

2)在需要的地方加入(例如{ // ... "bundles": [ { // app-bundle },{ // vendor-bundle // ... "dependencies": { // ... "string-template", // Points per default to index.js which works just fine { // Use some custom name and point it explicitly to the second module. Doesn't work... "name": "string-template-compile", "path": "../node_modules/string-template", "main": "compile" } } } ] } ):

foo/bar/code.ts

问题

如果我只在import * as Format from 'string-template'; import * as FormatCompile from 'string-template-compile'; & {}中添加string-template我的源代码,一切都按预期工作,但只要我添加第二个模块的自定义名称aurelia.json,就会发生以下情况:

  • Typescript告诉我string-template-compile我尝试导入模块(TS2307:Cannot find module 'string-template-compile'.
  • CLI进程以foo/bar/code.ts开始,在输出au run --watch后停止执行而没有任何其他错误。

在尝试仅将crypto-js中的特定模块导入到Tracing foo/bar/code...&时,我遇到了同样的问题。 crypto-js/aes而不是包括整个包(在NPM使用部分中描述为"模块化包含")。

修改:我还在an issue中创建了CLI repo,因为我似乎并没有在这里得到答案...

0 个答案:

没有答案