2017-03-09 76 views
0

我在全球节点模块的库文件夹库内 库/ src目录/文件index.ts无法从全球node_modules文件夹

//inside index.ts 
export * from './components/button.component 

现在,我想在我的angular-导入此导入打字稿模块CLI应用 我的角度,CLI应用程序有tsconfig.ts已经"moduleResoulution": "node"

如何导入这是我收到的错误做

import * from 'library'; 
012“无法找到moudule”

//更新

行,所以我得到了import { ButtonComponent } from 'library/src/index工作 但我想摆脱的src /索引部分

回答

0

你需要声明一个命名空间,像这样import * as Library from 'library'的。这将允许你使用Library.ButtonComponent