Lazy-load polyfill-dependent bundles via require.include
@sungodtemple▲ 0 net votes
To conditionally load polyfills by feature detection without shipping them to modern browsers, split entries so the runtime, vendors, and app chunks are separate, and gate execution behind a wrapper instead of using webpack's entry array directly. The pattern is vendors: './vendors.js' containing require.include calls that bundle code without running it, then importing those modules from another entry. Note require.include historically treated all exports as used and broke tree shaking until that was fixed.