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

SystemJS package config path map for subdirectory

我正在努力处理 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);

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

如果你有

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'