,所以我試圖導入ImmutableJs到我的角2的項目中,我使用這種systemjs配置如何配置SystemJs爲ImmutableJs在角2項目工作
(function(global) {
// map tells the System loader where to look for things
var map = {
'src/client': 'src/client', // 'dist',
'@angular': 'node_modules/@angular',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs',
'highcharts': 'node_modules/highcharts',
'angular2-highcharts': 'node_modules/angular2-highcharts',
'immutable': 'node_modules/immutable/dist'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'src/client': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
'highcharts': { defaultExtension: 'js' },
'angular2-highcharts': { main: 'index.js', defaultExtension: 'js' },
'immutable': { defaultExtension: 'js' }
};
var ngPackageNames = [
'common',
'compiler',
'core',
'forms',
'http',
'platform-browser',
'platform-browser-dynamic',
'router',
'router-deprecated',
'upgrade',
];
// Individual files (~300 requests):
function packIndex(pkgName) {
packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
}
// Bundled (~40 requests):
function packUmd(pkgName) {
packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
}
// Most environments should use UMD; some (Karma) need the individual index files
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
// Add package entries for angular packages
ngPackageNames.forEach(setPackageConfig);
var config = {
map: map,
packages: packages
};
System.config(config);
})(this);
,但它VS代碼犯規挑吧當我嘗試
import { Immutable } from 'immutable/dist/immutable';
我知道immutable.d.ts不是一個模塊。
import { Immutable } from 'immutable/immutable';
只是下降找不到模塊(儘管因爲我映射不可改變到immutable.js駐留不可改變/ dist目錄這應該工作)。在網上搜索我無法找到答案,我發現一些人問過去6個月werent回答的類似問題。任何幫助表示讚賞如果僅僅只是引導到可能在細節解釋什麼什麼
啊這是有道理的:)謝謝你一個全面的答案! – LithStud