0
angle-cli 도구를 사용하여 응용 프로그램을 만들었습니다. 내 응용 프로그램에 ng2 파일 업로드 패키지를로드하려고 시도하지만 404가 발생했습니다. 적절한 패키지에 매핑하도록 system-config.ts를 업데이트하는 제안을 시도했지만 여전히 404가 발생합니다. .Angular2 : Angular-CLI를 사용하여 빌드 된 구성 요소에 노드 모듈을로드 할 때 404 오류를 해결하는 방법
"use strict";
// SystemJS configuration file, see links for more information
// https://github.com/systemjs/systemjs
// https://github.com/systemjs/systemjs/blob/master/docs/config-api.md
/***********************************************************************************************
* User Configuration.
**********************************************************************************************/
/** Map relative paths to URLs. */
const map: any = {
'ng2-file-upload': 'node_modules/ng2-file-upload'
};
/** User packages configuration. */
const packages: any = {
'ng2-file-upload': { defaultExtension: 'js'}
};
////////////////////////////////////////////////////////////////////////////////////////////////
/***********************************************************************************************
* Everything underneath this line is managed by the CLI.
**********************************************************************************************/
const barrels: string[] = [
// Angular specific barrels.
'@angular/core',
'@angular/common',
'@angular/compiler',
'@angular/forms',
'@angular/http',
'@angular/router',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
// Thirdparty barrels.
'rxjs',
// App specific barrels.
'app',
'app/shared',
'app/order-details',
'app/check-payment-component',
'app/check-payment',
'app/myorder',
'app/item-details',
'app/shipping',
'app/payment',
'app/price-line',
'app/money-order-payment',
'app/credit-card-payment',
'app/wire-transfer-payment',
/** @cli-barrel */
];
const cliSystemConfigPackages: any = {};
barrels.forEach((barrelName: string) => {
cliSystemConfigPackages[barrelName] = { main: 'index' };
});
/** Type declaration for ambient System. */
declare var System: any;
// Apply the CLI SystemJS configuration.
System.config({
map: {
'@angular': 'vendor/@angular',
'rxjs': 'vendor/rxjs',
'main': 'main.js'
},
packages: cliSystemConfigPackages
});
// Apply the user's configuration.
System.config({ map, packages });
내 구성 요소에이 방법을 가져 해요 : : 여기
내 시스템 config.ts 파일의 :import { FileUploader, FileUploaderOptions, FILE_UPLOAD_DIRECTIVES } from 'ng2-file-upload';
내 응용 프로그램의 구조는 다음과 같습니다
const map: any = {
'ng2-file-upload': 'vendor/ng2-file-upload'
};
다음에 system-config.ts
에 매핑 vendor
디렉토리에 대한 종속성을 복사 할 각-CLI 말할