https://github.com/krakenjs/webpack-promise-shim-plugin
Plugin to shim in Promise polyfill into webpack core
https://github.com/krakenjs/webpack-promise-shim-plugin
Last synced: 2 months ago
JSON representation
Plugin to shim in Promise polyfill into webpack core
- Host: GitHub
- URL: https://github.com/krakenjs/webpack-promise-shim-plugin
- Owner: krakenjs
- Archived: true
- Created: 2018-01-26T23:52:48.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-27T01:15:09.000Z (over 7 years ago)
- Last Synced: 2025-04-14T20:06:59.572Z (3 months ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 2
- Watchers: 6
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```bash
npm install --save-dev webpack-promise-shim-plugin
```## Use
```javascript
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`