Do you want to request a feature or report a bug?
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce.
The following markup shows the use case of a large app that has pages that assumes a babel-polyfilled environment and may depend on either React or jQuery or both. A page often has a corresponding Webpack entry that shouldn’t redundantly bundle babel-polyfill, React, jQuery, or the Webpack runtime.
<html> <body> <!-- Download and run babel-polyfill, fetch polyfill modules, and webpack runtime. --> <script src="environment.js"></script> <!-- An ES6 environment should polyfilled --> <script>console.assert('Map exists.', typeof Map === 'function');</script> <script>console.assert('Set exists.', typeof Set === 'function');</script> <!-- Download react, react-dom --> <script src="vendor-react.js"></script> <!-- Download and run jquery, and a module that sets it on window --> <script src="vendor-jquery.js"></script> <script>console.assert('jQuery exists.', typeof jQuery === 'function');</script> <!-- Download and run page-specific code that may import react or jquery without bundling react or jquery in page-a.js --> <script src="page-a.js"></script> </body> </html>
What is the expected behavior?
Webpack 3 and it’s CommonsChunkPlugin supported this feature.
Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.
Webpack 4.5, Node 8.2, OS X 10.12.6.