Comments (3)
I'm currently working on the next release of this plugin. It will be possible to create one asset for each combination of needed polyfills. For example, if you configure that polyfills A, B and C are required, then webpack bundles assets for A, B, C, AB, AC, BC, ABC and the entry chunk will load the required one. The server does not need to do anything special because it just serves a static file that is contained in the bundle.
Of course, the overall bundle size will increase, but only one file per client is needed and it does not contain unnecessary polyfills, so it actually saves bandwidth.
Would that fit your needs, or do you need to rely on a polyfill-service that dynamically serves the files instead of generating every possible option at build time?
(There will still be the option to bundle only a single file contrasting all polyfills)
from webpack-polyfill-injector.
The new version 1.0.0
with the change mentioned above is currently in the develop
branch and can be installed using the @beta
tag:
yarn add webpack-polyfill-injector@beta --dev
npm install webpack-polyfill-injector@beta --save-dev
Does that fit the needs requested here?
from webpack-polyfill-injector.
1.0.0
has been released and supports the following configuration:
entry: {
entry1: `webpack-polyfill-injector?${JSON.stringify({
modules: ['./src/entry1.js'],
polyfills: ['Promise', 'Array.prototype.find'],
})}!`,
entry2: `webpack-polyfill-injector?${JSON.stringify({
modules: ['./some-vendor-script-that-will-be-loaded-first.js', './src/entry2.js'],
polyfills: ['String.prototype.startsWith'],
})}!`,
},
If you have other requirements that are not possible with the new update then please open a new issue explaining the use-case. Thanks!
from webpack-polyfill-injector.
Related Issues (20)
- optional `publicPath` is used in the src filename when loading polyFilly HOT 1
- Use new polyfill-library package HOT 1
- Version 1.0.2 contains breaking changes HOT 2
- '$' is undefined (conflicts with expose-loader?) HOT 29
- Improve documentation HOT 1
- Synchronous option
- Feature: Support default sets HOT 2
- webpack 4 promise HOT 4
- UglifyJS break Function.name test by default settings. HOT 1
- Webpack 3.11 crashes on Object.setPrototypeOf polyfill HOT 1
- missing polyfill for forEach HOT 1
- Define groups of polyfills
- npm install error after webpack-polyfill-injector was added to package.json HOT 3
- PolyFillLibrary is not a constructor HOT 4
- How to remove "use strict" to support ie11 HOT 4
- Not working when using code splitting and splitChunk HOT 1
- Load from polyfill.io HOT 1
- Error when `output.filename` is a function
- Does not work with webpack-manifest-plugin
- plugin breaks when using webpack 5 cache
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webpack-polyfill-injector.