【问题标题】:Failed to load resource: Observable.js.map in Safari 9.1.2加载资源失败:Safari 9.1.2 中的 Observable.js.map
【发布时间】:2017-02-01 02:43:30
【问题描述】:

我在 Angular 2 final 和 Angular-cli 中使用 observables。

  • Angular 2.0.0 最终版
  • angular-cli: 1.0.0-beta.15
  • 节点:6.3.0
  • Mac 操作系统:el capitan

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会遇到这个错误。

【问题讨论】:

  • 我在 ios 8.3 上运行的 Ionic 应用也遇到了同样的问题,你解决了吗?
  • 我也有同样的问题,你解决了吗?

标签: angular angular-cli rxjs5 angular2-observables


【解决方案1】:

请在您的 tsconfig.json 文件中将 sourceMap 标志从 false 设置为 True。

{
"compilerOptions": {
 ///////////////////////
    "sourceMap": true,
////////////////////////

}

因为我遇到了同样的问题,之后我工作正常:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-16
    • 2015-09-17
    • 1970-01-01
    • 2016-02-27
    • 2012-07-24
    • 2018-01-15
    • 2013-02-26
    • 2019-05-28
    相关资源
    最近更新 更多