Angular2 cordova safari网页检查器加载错误



我试图设置一个应用程序与cordova, angular2和sqlite,

使用cordova模拟ios,应用程序加载得非常好,npm start也是如此。

如果我注释掉,

<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>
    <script src="systemjs.config.js"></script>
    <script>
    System.import('app').catch(function(err){ console.error(err); });
</script>

我可以从

获取日志
document.addEventListener('deviceready', function() {
var db = window.sqlitePlugin.openDatabase({name: 'test.db', location: 'default'});
    db.transaction(function(tr) {
        tr.executeSql("SELECT upper('Test string') AS upperString", [], function(tr, rs) {
            console.log('Got upperString result: ' + rs.rows.item(0).upperString);
        });
    });
});

safari web inspector,如果我不注释掉前面提到的脚本标签,当我重新加载web inspector我得到,

[错误]加载资源失败:请求的URL没有找到此服务器。(index.css, line 0)

[错误]加载资源失败:请求的URL没有找到此服务器。(shimm .min.js, line 0)

[错误]加载资源失败:请求的URL没有找到此服务器。(zone.js, line 0)

[错误]加载资源失败:请求的URL没有找到此服务器。(Reflect.js, line 0)

[错误]加载资源失败:请求的URL没有找到此服务器。(system.src.js, line 0)

[Error] ReferenceError: Can't find variable: System global code(index . html: 15)

[错误]加载资源失败:请求的URL没有找到此服务器。(systemjs.config.js,第0行)

[错误]加载资源失败:请求的URL没有找到此服务器。(index.js, line 0)

[错误]加载资源失败:请求的URL没有找到此服务器。(cordova.js,第0行)

我想知道为什么web检查器找不到资源,我如何解决这个问题?

好了,我找到了导致问题的原因@angular/router.

当我从@ngmodules imports中移除路由时,

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { routing } from './app.routing';
import { AppComponent }   from './app.component';
@NgModule({
    imports:      [ BrowserModule],
    declarations: [ AppComponent ],
    bootstrap:    [ AppComponent ]
})
export class AppModule { }

我没有得到错误信息时,重新加载safari网页检查器和一切加载在fine.

最新更新