【问题标题】:Angular2 : TypeError: p is undefined in system.src.js ON FIREFOXAngular2:TypeError:p 在 FIREFOX 上的 system.src.js 中未定义
【发布时间】:2016-04-01 00:26:31
【问题描述】:

我在 angular2 beta 12 下运行我的应用程序,它在 Chrome 上完美运行,但在 Firefox 上它崩溃并持续显示 "Loading..."

有人告诉我这是 firefox polyfills 的问题。

有什么建议吗?

顺便说一下,这是我的 index.html

<html>
<head>
    <base href="/">
    <title>Minuiserie SIFAST</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">


    <link rel="stylesheet" type="text/css" href="/node_modules/bootstrap/dist/css/bootstrap.css">

    <link rel="stylesheet" href="node_modules/ng2-material/dist/ng2-material.css">
    <link rel="stylesheet" href="node_modules/ng2-material/dist/font.css">


    <!-- Load libraries -->
    <!-- IE required polyfills, in this exact order -->
    <script src="node_modules/es6-shim/es6-shim.min.js"></script>
    <script src="node_modules/systemjs/dist/system-polyfills.js"></script>
    <script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
    <script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
    <script src="node_modules/systemjs/dist/system.src.js"></script>
    <script src="node_modules/typescript/lib/typescript.js"></script>
    <script src="node_modules/rxjs/bundles/Rx.js"></script>
    <script src="node_modules/angular2/bundles/angular2.dev.js"></script>
    <script src="node_modules/angular2/bundles/router.dev.js"></script>
    <script src="node_modules/angular2/bundles/http.js"></script>





    <!--importer ici les js de jquery-->

    <script src="./dev/resources/js/jquery.js"></script>
    <script src="./dev/resources/js/jquery-ui.js"></script>



    <script src="./dev/jqueryLibs/jquery-1.12.1.min.js"></script>
    <script src="./dev/jqueryLibs/jquery-migrate-1.2.1.min.js"></script>




    <!--importer ici la js de bootstrap-->
    <script src="node_modules/bootstrap/dist/js/bootstrap.js"></script>


    <!--Importer ici hammer.js-->
    <script src="dev/jqueryLibs/hammer/hammer.js" type="text/javascript"></script>



</head>
<body>
<app>Loading...</app>

<script>
    System.config({

        //use typescript for compilation
        transpiler: 'typescript',
        //typescript compiler options
        typescriptOptions: {
            emitDecoratorMetadata: true,

        },
        //map tells the System loader where to look for things
        map: {
            "ng2-material":"node_modules/ng2-material"




        },


        packages: {
            app: {
                format: 'register',
                defaultExtension: 'js'
            },
            'ng2-material': {
                defaultExtension: 'js'
            }
        }

    });
    System.import('app/boot')
            .then(null, console.error.bind(console));
</script>


 </body>

TSCONFIG:

{
  "compilerOptions": {
    "target": "ES5",
    "module": "system",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false,
    "outDir": "./app"
  },
  "filesGlob": [
    "./dev/**/*.ts",
    "!./node_modules/**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ],
  "atom": {
    "rewriteTsconfig": true
  }
}

【问题讨论】:

  • 控制台出现什么错误??
  • 你想在浏览器(运行时)中使用 typescript 编译器吗?因为如果你这样做了,你应该将app包中的格式更改为esm,并将默认扩展名更改为ts
  • 在firefox的cnsole中只有一个错误,它是问题的标题:type ertor is undefined in system.src
  • 不,我不会,幸好我的应用程序在 chrome 上运行,但在 gitegox 中它崩溃了,我想解决这个问题
  • 那你为什么要添加打字稿库并在你的systemjs配置中有打字稿选项

标签: node.js firefox typescript angular angular2-template


【解决方案1】:

此问题已被声明为 44 以下版本的 firefox 问题

我只是通过使用 firefox 46 或 firefox developer 47 解决了这个问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-15
    • 2012-07-18
    • 2019-11-13
    • 1970-01-01
    • 2022-09-29
    • 2016-08-21
    • 2016-09-12
    相关资源
    最近更新 更多