小编Spl*_*lex的帖子

角差负载。如何将专用Polyfills添加到es5或es2015输出包中

使用Angular版本8和差异加载,在为生产而构建时会创建两个捆绑包:一个用于支持ES2015 +的现代浏览器的捆绑包,一个用于仅支持ES5版本的JavaScript的较旧浏览器的捆绑包。由于较新的浏览器支持ES6模块,因此浏览器会自动加载正确的捆绑软件。Angular还自动创建了polyfill文件。

有没有一种方法可以将专用的polyfill添加到ES5输出捆绑包中,这样它们就不会在ES2015 +输出捆绑包中列出?

Angular提供了一个polyfills.ts文件,可以在其中添加polyfills。但是我看不到如何将某些polyfill仅添加到ES5输出包中来构造该文件。

/**
 * This file includes polyfills needed by Angular and is loaded before the app.
 * You can add your own extra polyfills to this file.
 *
 * This file is divided into 2 sections:
 *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
 *   2. Application imports. Files imported after ZoneJS that should be loaded before your main
 *      file.
 *
 * The current setup is …
Run Code Online (Sandbox Code Playgroud)

polyfills webpack angular-cli angular

6
推荐指数
0
解决办法
689
查看次数

如何在 Angular 中将 contentchildren 的每个孩子包装在他们自己的元素中

假设我想制作一个排列其所有子项的组件。我应该能够提供元素,例如:

<app-layout-list>
  <p>foo</p>
  <p>bar</p>
  <p>etc</p>
</app-layout-list>
Run Code Online (Sandbox Code Playgroud)

在 app-layout-list 里面应该做一些类似的事情

<ul>
  <li>
    <ng-content>
  </li>
<ul>
Run Code Online (Sandbox Code Playgroud)

它为每个内容生成一个 li。这可以使用 ng-content 还是我需要做一些更复杂的事情?

html typescript angular

4
推荐指数
1
解决办法
1809
查看次数

标签 统计

angular ×2

angular-cli ×1

html ×1

polyfills ×1

typescript ×1

webpack ×1