0

虽然我在所有其他方面都喜欢 Angular 2,但我发现支持基础设施具有挑战性,特别是在我的 angular2-seed 项目中如何正确引用节点模块时。

我已经成功安装了 ng2-responsive 以便它在 app.module.ts 中找到它:

import { ResponsiveModule } from 'ng2-responsive';

通过添加:

map: {
    'ng2-responsive': 'node_modules/ng2-responsive',
},
packages: {
    'ng2-responsive': {
        main: './index.js',
        defaultExtension: 'js'
    }
}

到 SYSTEM_CONFIG_DEV 下的 seed.config.ts

但是,我现在得到:

[...]node_modules/ng2-responsive/index.d.ts(1,90): error TS2307: Cannot find module './bootstrap/bootstrap-directives'

当它在我运行 npm start 后尝试运行 build.dev.js 时,对于 ng2-responsive 的 index.d.ts 中引用的其他指令也是如此......大概是因为它们是这样引用的:

import { XL, LG, MD, SM, XS, ShowItBootstrap, HideItBootstrap, ResponsiveSizeInfo } from './bootstrap/bootstrap-directives';

并且该路径是相对于 index.d.ts 的,而不是它当前运行的位置。

我有什么想法告诉 build.dev.js 在它们实际存在的地方寻找它们吗?

非常感谢

4

0 回答 0