本文介绍了Aurelia Typescript项目仅在Chrome上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道为什么在此git存储库中列出的Aurelia-Typescript项目仅在Chrome浏览器上起作用?

Does anyone know why Aurelia-Typescript projects listed in this git repository only functions on Chrome browser?

Chrome上当前仅支持ES6功能,而IE或FireFox上不支持吗?

Are there ES6 features that are only currently supported on Chrome and not on IE or FireFox?

EDIT -以下是来自Firefox 34.0.5的错误消息

EDIT - below are the error messages from Firefox 34.0.5

更改对象的[[Prototype]]将导致您的代码运行非常缓慢;而是使用Object.create core.js:130

mutating the [[Prototype]] of an object will cause your code to run very slowly;instead create the object with the correct initial [[Prototype]] value using Object.create core.js:130

未声明HTML文档的字符编码.如果文档包含来自US-ASCII范围之外的字符,则在某些浏览器配置中,文档将呈现乱码.页面的字符编码必须在文档或传输协议中声明. index.html

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol. index.html

调试[引导程序]加载HTMLImports polyfill" core.js:2518

"DEBUG [bootstrapper] loading the HTMLImports polyfill" core.js:2518

此页面上的脚本已禁用Web控制台日志记录API(console.log,console.info,console.warn,console.error).

The Web Console logging API (console.log, console.info, console.warn, console.error) has been disabled by a script on this page.

错误:以下网页的脚本错误:webcomponentsjs/HTMLImports.min http://requirejs.org/docs/errors.html#scripterror require.js: 166

Error: Script error for: webcomponentsjs/HTMLImports.minhttp://requirejs.org/docs/errors.html#scripterror require.js:166

推荐答案

在aurelia-bundle.js的第15346行(引导程序部分)中,它检查是否支持HTML导入:

In aurelia-bundle.js at line 15346 (bootstrapper part) it checks whether HTML import is supported:

      if (!("import" in document.createElement("link"))) {
        logger.debug("loading the HTMLImports polyfill");
        toLoad.push(System.normalize("webcomponentsjs/HTMLImports.min", loaderName).then(function (name) {
          return System["import"](name);
        }));
      }

唯一支持现成的浏览器仍然是Chrome.对于其他浏览器,HTMLImports polyfill加载失败,原因是:

The only browser that supports it out-of-the-box is still Chrome. For the other browsers HTMLImports polyfill loading fails because:

    中的 webcomponentsjs 目录中缺少
  1. HTMLImports.min.js.
  2. 路径应为"aurelia/webcomponentsjs/HTMLImports.min".最好将webcomponentsjs移到根路径(我不知道如何通过捆绑来处理)
  3. 按照下面的@Chi Row的答案回答HTML模板元素polyfill(IE 11似乎支持它们,因此无需使用).
  1. HTMLImports.min.js is missing from webcomponentsjs directory
  2. The path should be "aurelia/webcomponentsjs/HTMLImports.min". It might be better to move webcomponentsjs to the root path (I don't know how this can be handled through bundling)
  3. Follow @Chi Row's answer below for HTML Template Element polyfill (IE 11 seems supporting them, so it worked without).

这篇关于Aurelia Typescript项目仅在Chrome上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 18:47