Javascript angular 6自定义元素在IE11和Firefox上失败,出现语法和阴影dom错误

Javascript angular 6自定义元素在IE11和Firefox上失败,出现语法和阴影dom错误,javascript,angular,html,typescript,Javascript,Angular,Html,Typescript,我已经创建了一个新的angular cli项目,使用自定义元素。它在铬上工作得非常好。 我已经评论了Internet Explorer所有必要的多边形填充 我已经包括了额外的@webcomponents/。。。但是@webcomponents造成了一个问题 node_modules/@webcomponents/custom elements/src/native-shim.js 包含internet explorer不支持的箭头函数,因此出现以下错误: 语法错误 如果有人能给我指一个angul

我已经创建了一个新的angular cli项目,使用自定义元素。它在铬上工作得非常好。 我已经评论了Internet Explorer所有必要的多边形填充

我已经包括了额外的@webcomponents/。。。但是@webcomponents造成了一个问题

node_modules/@webcomponents/custom elements/src/native-shim.js 包含internet explorer不支持的箭头函数,因此出现以下错误:

语法错误 如果有人能给我指一个angular cli演示/repo,它在任何地方都可以编译并在IE11上工作,这将是一个巨大的帮助

我的完整多边形填充如下所示:

/***************************************************************************************************
 * BROWSER POLYFILLS
 */
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js';  // Run `npm install --save classlist.js`.

/** IE10 and IE11 requires the following for the Reflect API. */
import 'core-js/es6/reflect';


/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';


/**
 * Web Animations `@angular/platform-browser/animations`
 * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
 * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
 **/
// import 'web-animations-js';  // Run `npm install --save web-animations-js`.

/**
 * By default, zone.js will patch all possible macroTask and DomEvents
 * user can disable parts of macroTask/DomEvents patch by setting following flags
 */

 // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
 // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
 // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames

 /*
 * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
 * with the following flag, it will bypass `zone.js` patch for IE/Edge
 */
// (window as any).__Zone_enable_cross_context_check = true;

/***************************************************************************************************
 * Zone JS is required by default for Angular itself.
 */
import 'zone.js/dist/zone';  // Included with Angular CLI.

import '@webcomponents/custom-elements/custom-elements.min';
import '@webcomponents/custom-elements/src/native-shim';
import 'bluebird';

/***************************************************************************************************
 * APPLICATION IMPORTS
 */

这里的人,这保存了我的理智在过去的2天,点击和祝福;D

基本上,这家伙从组件中删除了本机封装,并以明显正确的方式使用了polyfills,我自己无法确定这一点


如果您签出这个请求,运行npm安装、npm运行构建、npm运行包和npm运行服务,所有这些都应该在Chrome上运行,FF和IE11至少对我有效。

根据我的经验,建议的答案不会在所有情况下都有效。只需尝试在一个文件中放置两个基于角度的web组件,您将无法获得预期的行为。查看这个最新的工作示例。

我不认为firefox实现了shadow dom。显然,您可以使用一个首选项打开它-请您清楚哪个浏览器中存在哪些错误-因为firefox肯定支持箭头功能。。。请显示错误消息,而不仅仅是对设置为es5的tsconfig.json中的目标的模糊描述?@PierreDuc,是的,我目前正在研究同一主题。我使用了另一种引导方法,目前这种方法也不起作用,但它可能会为您提供一些可以解决问题的输入:即使没有ViewEncapsulation.Native,我也无法让它起作用。我只有封装模式None和Angular Elementagreed中的默认模拟集:我们放弃了这个。。。它在IE中不起作用。实际上,如果不使用shadow div viewEncapsulation.Native,它在IE中起作用。但在我看来,shadowdiv是一个重要的特性,它使web组件变得非常有用。
/***************************************************************************************************
 * BROWSER POLYFILLS
 */
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js';  // Run `npm install --save classlist.js`.

/** IE10 and IE11 requires the following for the Reflect API. */
import 'core-js/es6/reflect';


/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';


/**
 * Web Animations `@angular/platform-browser/animations`
 * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
 * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
 **/
// import 'web-animations-js';  // Run `npm install --save web-animations-js`.

/**
 * By default, zone.js will patch all possible macroTask and DomEvents
 * user can disable parts of macroTask/DomEvents patch by setting following flags
 */

 // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
 // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
 // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames

 /*
 * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
 * with the following flag, it will bypass `zone.js` patch for IE/Edge
 */
// (window as any).__Zone_enable_cross_context_check = true;

/***************************************************************************************************
 * Zone JS is required by default for Angular itself.
 */
import 'zone.js/dist/zone';  // Included with Angular CLI.

import '@webcomponents/custom-elements/custom-elements.min';
import '@webcomponents/custom-elements/src/native-shim';
import 'bluebird';

/***************************************************************************************************
 * APPLICATION IMPORTS
 */