angular2 systemJs相对路径问题

时间:2016-03-23 12:35:28

标签: angular systemjs

我在角度2中使用ng2-bootstrap时遇到问题.SystemJS无法解析node_modules目录的时刻,而是抱怨相对路径。

这是使用import

从路径构造的组件引用的
import { TOOLTIP_DIRECTIVES } from 'ng2-bootstrap';

有人可以帮忙吗?

提前致谢。

<script src="~/node_modules/systemjs/dist/system.src.js"></script>
<script src="~/node_modules/es6-shim/es6-shim.min.js"></script>
<script src="~/node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="~/node_modules/moment/min/moment.min.js"></script>
<script src="~/node_modules/ng2-bootstrap/ng2-bootstrap.js"></script>
<script>
    System.config({
        defaultJSExtensions: true,
        baseURL: '/ECAV.Admin/node_modules',
        packages: {
            'app': { format: 'register', defaultExtension: 'js' },
            'rxjs': { defaultExtension: 'js' }
        },
        paths: {
            'angular2/*': 'angular2/*',
            'rxjs': 'rxjs/bundles/Rx.js',
            'linqsharp': 'linqsharp/built/linqsharp',
            'highcharts': 'highcharts',
            'ng2-highcharts': 'ng2-highcharts/ng2-highcharts',
            'lodash': 'lodash/lodash',
            'ng2-bootstrap':'ng2-bootstrap/ng2-bootstrap'
        },
        map: {
            moment: 'moment/moment.js'
        }
    });
</script>
<script src="~/node_modules/rxjs/bundles/Rx.js"></script>
<script src="~/node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="~/node_modules/lodash/lodash.js"></script>

1 个答案:

答案 0 :(得分:0)

关于时刻库的配置,你可以试试这个:

System.config({
  (...)
  map: {
    'moment': 'moment/moment'
  },
  (...)
});

看到这个问题:

  • {{3}}
相关问题