UPDATE@types找不到404 angular2
我在這裏https://www.dropbox.com/s/g3k4phhqffleeh0/jsapi4-angular2.zip?dl=0添加的代碼,有人請幫助:(
========
我有一個角度2的項目,我分叉並開始工作
一切都很好,花花公子,直到我真的需要安裝一些類型和使用它們。在類型上,可以找到它們。建設也不是問題。但是SystemJS似乎無法找到類型。我一直在爭奪這個約10小時,似乎無法找到一個解決辦法:(請幫助。
systemjs.config.js
/**
* System configuration for Angular 2 samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
transpiler: 'typescript',
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
'app': 'app', // 'dist',
// angular bundles
'@angular/core': 'npm:@angular/[email protected]/bundles/core.umd.js',
'@angular/common': 'npm:@angular/[email protected]/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/[email protected]/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/[email protected]/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/[email protected]/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/[email protected]/bundles/http.umd.js',
'@angular/router': 'npm:@angular/[email protected]/bundles/router.umd.js',
// angular testing umd bundles
'@angular/core/testing': 'npm:@angular/[email protected]/bundles/core-testing.umd.js',
'@angular/common/testing': 'npm:@angular/[email protected]/bundles/common-testing.umd.js',
'@angular/compiler/testing': 'npm:@angular/[email protected]/bundles/compiler-testing.umd.js',
'@angular/platform-browser/testing': 'npm:@angular/[email protected]/bundles/platform-browser-testing.umd.js',
'@angular/platform-browser-dynamic/testing': 'npm:@angular/[email protected]/bundles/platform-browser-dynamic-testing.umd.js',
'@angular/http/testing': 'npm:@angular/[email protected]/bundles/http-testing.umd.js',
'@angular/router/testing': 'npm:@angular/[email protected]/bundles/router-testing.umd.js',
// other libraries
'rxjs': 'npm:[email protected]',
'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',
'esri': 'http://js.arcgis.com/4.0/esri'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
},
'angular2-in-memory-web-api': {
main: './index.js',
defaultExtension: 'js'
},
'@types/highcharts': {defaultExtension: 'ts'}
}
});
})(this);
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"lib": [ "es2015", "dom" ],
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": ["jsapi4-angular2/node_modules/", "jsapi4-angular2/typings/"]
},
"exclude": [
"node_modules/zone.js",
"node_modules/concurrently",
"node_modules/lite-server",
"node_modules/typescript",
"node_modules/typings",
"node_modules/reflect-metadata",
"node_modules/rxjs",
"node_modules/tslint",
"bower_components",
"typings/main",
"typings/main.d.ts"
]
}
esriSystemLoadBrowser.js
// load esri modules needed by this application
// into a System.js module called esri
console.log("Loading esri modules: ", esriLoadConfig.modules);
start = performance.now();
esriSystem.register(esriLoadConfig.modules, function() {
// then bootstrap application
end = performance.now();
time = end - start;
console.log('Loaded esri modules', time/1000.0);
System.config({
transpiler: 'typescript'
});
System.import('app/main').then(function() {
console.log('app/main imported');
}, function (error) {
console.log("System import error:", error);
});
});
你應該嘗試掛接對應於類型的JS文件,而不是類型本身。類型只是編譯時。 JS文件用於運行時 –
你會碰巧知道如何做到這一點?很抱歉的愚蠢的問題:/ –
我從不使用highcharts,所以我不能過頭頂說。這是我需要測試的東西,但我現在沒有我的工具。 –