[Webpack 2] Polyfill Promises for Webpack 2
Posted Answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Webpack 2] Polyfill Promises for Webpack 2相关的知识,希望对你有一定的参考价值。
If you‘re going to use code splitting with Webpack 2, you‘ll need to make sure the browser has support for the ES6 Promise
API. This means that if you are required to support an old browser, you need to provide a polyfill. Polyfilling is relatively trivial to do with Webpack, but because Webpack itself depends on this particular polyfill, you have to come up with another way of doing so. In this lesson, we‘ll see how we can use the polyfill.io service to automatically polyfill this API (and others) for us.
Just include the polyfill into index.html:
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
以上是关于[Webpack 2] Polyfill Promises for Webpack 2的主要内容,如果未能解决你的问题,请参考以下文章
webpack优化篇(五十):使用动态 Polyfill 服务
带有 webpack 的 Intl.js polyfill/shim?