webpack-promise-shim-plugin

1.0.0 • Public • Published

Webpack Promise Shim Plugin

The problem

Webpack, in generated builds, uses promises for things like lazy-loading, chunking, etc.

Problem is, it relies on window.Promise being set, which ain't the case in IE or other older browsers. You can polyfill window.Promise, but that's a bad idea if you're trying to run on 3rd party domains you don't own.

This plugin allows you to specify your own promise polyfill for webpack to use, without shimming window.Promose

Install

npm install --save-dev webpack-promise-shim-plugin

Use

const { WebpackPromiseShimPlugin } = require('webpack-promise-shim-plugin');

...

plugins: [
    new WebpackPromiseShimPlugin({
        module: 'zalgo-promise/src',
        key:    'ZalgoPromise'
    }),
]

Notes

  • Only testing with Webpack 3, your mileage may very on other versions
  • Only works right now in conjunction with webpack.NamedModulesPlugin

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    0

Package Sidebar

Install

npm i webpack-promise-shim-plugin

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bluepnume