代码之家  ›  专栏  ›  技术社区  ›  Milo Kang

子目录的SystemJS包配置路径映射

  •  0
  • Milo Kang  · 技术社区  · 7 年前

    我正在努力为systemjs映射路径。

    下面是我当前的配置。 @angular-redux/form/dist/source/connect 成为 @angular-redux/form/dist/source/connect/index.js

    但它一直指向 @angular-redux/form/dist/source/connect.js

    我假设我没有写正确的地图,或者我应该用meta来代替。。。 有人能带我过去吗?

    'use strict';
    /**
     * System configuration for Angular samples
     * Adjust as necessary for your application needs.
     */
    (function () {
      System.config({
        paths: {
          // paths serve as alias
          'npm:': '../node_modules/'
        },
        // map tells the System loader where to look for things
        map: {
          "@angular-redux/form": "npm:@angular-redux/form"
        },
        // packages tells the System loader how to load when no filename and/or no extension
        packages: {
          '@angular-redux/form': {
            main: 'dist/source/index.js',
            map: {
              './connect': './connect/index.js',
              './connect-array': './connect-array/index.js'
            }
          }
        }
      });
    })(this);
    1 回复  |  直到 7 年前
        1
  •  1
  •   Steverob2k    7 年前

    我认为您没有映射到正确的位置。

    如果你有

    import '@angular-redux/form/dist/source/connect'
    

    映射需要类似于以下内容:

    './dist/source/connect': './dist/source/connect/index.js',
    './dist/source/connect-array': './dist/source/connect-array/index.js'
    

    如果你有

    import '@angular-redux/form/connect'
    

    映射需要类似于以下内容:

    './connect': './dist/source/connect/index.js',
    './connect-array': './dist/source/connect-array/index.js'