systemjs无法链接和下载我的新模块

时间:2016-12-05 20:07:20

标签: angular npm systemjs

我创建了一个角度模块,使用npm作为我公司注册表中的私有节点模块

进行下载

我的systemjs总是使用任何扩展名在我当前的目录中搜索它,即使我将默认扩展名设置为js

1 个答案:

答案 0 :(得分:1)

确保您的systemjs配置能够正确映射所有映射

下面是一个systemjs confi,它将不同的angular2模块保存为单独的

modules and loads from different folders
(function (global) {
  System.config({
    defaultExtension: 'js',
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/'
    },
    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      app: 'src',
      // angular bundles
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',

      // other libraries
      'rxjs':                      'npm:rxjs',
      'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
      'ng2-pagination': 'npm:ng2-pagination/dist/ng2-pagination-bundle.js',

      //private modules
      'local': 'local/',
      'candi-services': 'npm:candi-services',
      'candi-loader': 'npm:candi-loader',
      'candi-global-search': 'npm:candi-global-search'

    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      defaultExtension: 'js',
      app: {
        main: 'app/main.js',
        defaultExtension: 'js'
      },
      local: {
        main: 'main.js',
        defaultExtension: 'js'
      },
      'candi-loader' : {
        main: './index.js',
        defaultExtension: 'js'
      },
      'candi-services' : {
        main: './index.js',
        defaultExtension: 'js'
      },
       'candi-global-search' : {
        main: './index.js',
        defaultExtension: 'js'
      },
      rxjs: {
        defaultExtension: 'js'
      },
      'angular-in-memory-web-api': {
        main: './index.js',
        defaultExtension: 'js'
      }
    }
  });
})(this);