做一个小的Angular 2 + TypeScript网站,它在我的开发机器(localhost)上运行得很好但是当我部署到测试主机(Azure网站)时,我找不到 main.ts 。我搜索了几个博客,其中错误从拼写错误变为使用js文件上的旧版本,而不是那些解决方案适用于我。我正在使用Visual Studio 2015作为我的IDE。
这是我的设置
PersonalBlogAngular
|
|
---app
| |
| app.module.ts
| main.ts
| [I have several components]
|
---index.html
---package.json
---tsconfig.js
这是我的tsconfig.js
{
"compilerOptions": { "target": "es6",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2016", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"node_modules",
"wwwroot/lib"
]
}
这是我的package.js
{
"version": "1.0.0",
"name": "asp.net",
"dependencies": {
"@angular/common": "~2.4.0",
"@angular/compiler": "~2.4.0",
"@angular/core": "~2.4.0",
"@angular/forms": "~2.4.0",
"@angular/http": "~2.4.0",
"@angular/platform-browser": "~2.4.0",
"@angular/platform-browser-dynamic": "~2.4.0",
"@angular/router": "~3.4.0",
"core-js": "^2.4.1",
"rxjs": "~5.0.2",
"zone.js": "^0.7.4",
"systemjs": "^0.19.41"
},
"devDependencies": {
}
}
这是我的主要内容。
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);
这是我的index.html
<!DOCTYPE html>
<html>
<head>
<link href="assets/css/bootstrap.css" rel="stylesheet" />
<link href="assets/css/custom.css" rel="stylesheet" />
<link href="assets/css/font-awesome.css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Indie+Flower" rel="stylesheet">
<link rel="shortcut icon" href="http://gorillacode.net/wp-content/uploads/2016/06/favicon.ico">
<!-- Polyfills for older browsers -->
<script src="https://unpkg.com/core-js/client/shim.min.js"></script>
<script src="https://unpkg.com/zone.js@0.7.4?main=browser"></script>
<script src="https://unpkg.com/reflect-metadata@0.1.8"></script>
<script src="https://unpkg.com/systemjs@0.19.41/dist/system.src.js"></script>
<script src="https://cdn.rawgit.com/angular/angular.io/b3c65a9/public/docs/_examples/_boilerplate/systemjs.config.web.js"></script>
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<body>
<appBlog>Loading...</appBlog>
</body>
</html>
使用该设置我收到此错误XHR NOT FOUND main.ts
为什么我收到XHR错误404 Not Found:在部署到主机时加载main.ts?