내 SystemJS 파일은 다음과 같다 :이에서SystemJS :로드 빌드 파일
(function(global) {
// map tells the System loader where to look for things
var map = {
'angular2-boot': 'app', // 'dist',
'@angular': 'node_modules/@angular',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
// 'app': { main: 'js/main.js', defaultExtension: 'js' },
'app': { main: 'dist/build.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { defaultExtension: 'js' }
};
var ngPackageNames = [
...
];
// Add package entries for angular packages
ngPackageNames.forEach(function(pkgName) {
packages['@angular/'+pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' };
});
var config = {
map: map,
packages: packages
};
System.config(config);
})(this);
나는 tsconfig.js에서 OUTDIR 옵션을 다른 디렉토리에 내 타이프 라이터를 transpiled 및 패키지에 주요 사용하는 것을 언급 '의 JS/main.js '잘 작동합니다.
그러나 내가 outFile 옵션을 사용하여 단일 파일로 변환하려고 시도했을 때 main : 'dist/build.js'를 사용하여 해당 파일을 참조했습니다. 페이지를 렌더링하지 않으며 콘솔에 오류가 표시되지 않습니다.
내 index.html을은 다음과 같습니다
<html>
<head>
<title>Angular 2 QuickStart</title>
<base href="/">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="app/css/styles.css">
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('angular2-boot').catch(function(err){ console.error(err); });
</script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>
</html>
내 tsconfig.js 파일은 다음과 같다 :
{
"compilerOptions": {
"target": "es5",
"module": "amd",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"outDir": "app/js",
"outFile": "app/dist/build.js"
}
}
그것은로드 말한다 ... 내가 페이지를로드 할 때. SystemJS를 사용하여 단일 출력 파일을로드하려면 어떻게해야합니까?
파일이로드되지 않은 것 같아서 브라우저의 네트워크 탭을 확인하십시오. – WiredPrairie
build.js가로드되는 것을 볼 수 있습니다. 200 개의 반환 코드가 있으며 build.js 소스도 볼 수 있습니다. –