我在Angular-cli的Angular 2决赛中使用了observable。
package.json中的依赖项:
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"bootstrap-sass": "^3.3.7",
"chart.js": "^2.2.2",
"core-js": "^2.4.1",
"d3": "^4.2.3",
"d3-tip": "^0.7.1",
"ionicons": "^3.0.0",
"moment": "^2.15.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
}
我的应用程序在Safari 9.1.2以外的每个浏览器中都能正常运行 - 它会将此错误消息抛出到控制台:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4200/Observable.js.map
我试图在angular_cli.json中导入Rxjs:
"scripts": [
"../node_modules/rxjs/Rx.js"
],
另外,我试图将rxjs导入到app.module.ts以及像这样的工作组件:
import {Observable} from 'rxjs/Rx';
但是仍然会遇到同样的错误。
我做错了吗? 很奇怪,只有Safari遇到这个错误。
答案 0 :(得分:0)
请在tsconfig.json文件中将sourceMap标志设置为false。
{
"compilerOptions": {
///////////////////////
"sourceMap": true,
////////////////////////
}
因为我遇到了同样的问题,之后我工作得很好:)