【发布时间】: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