A Webpack plugin v3.8.0 (latest) that works alongside html-webpack-plugin to externalize specified module bundles, injecting script or link tags into the generated HTML. It automates the process of using pre-packaged vendor bundles (e.g., React, Lodash) via CDN or local files, reducing bundle size and improving caching. Unlike webpack's built-in externals, this plugin integrates directly with html-webpack-plugin to add the corresponding <script> or <link> tags. It requires html-webpack-plugin >=2.0.0 as a peer dependency. The plugin has been in maintenance mode with infrequent updates; last release was in 2019. Supports Node >=4.3.0.
npm install html-webpack-externals-pluginVerified import paths — ran on the pinned version, not inferred.
Configures webpack to externalize React and ReactDOM via CDN URLs, automatically adding script tags to HTML.
Use html-webpack-plugin v3.x or lower. For v4, consider using html-webpack-plugin's built-in script loading or other alternatives.
Add `externals: { 'react': 'React', 'react-dom': 'ReactDOM' }` to your webpack config.Ensure consistency: the global name in the plugin entry, webpack externals, and the CDN script's object reference all match.
Consider using `html-webpack-plugin`'s own `externals` option or manually adding scripts via template.
Run `npm install html-webpack-externals-plugin --save-dev`
Use `const HtmlWebpackExternalsPlugin = require('html-webpack-externals-plugin');`Ensure html-webpack-plugin is v3.x and webpack is v4.x. The plugin may not work with webpack 5.