Webpack plugin (v1.1.0) that fetches data from remote sources at build time and writes the results to static files. Designed for scenarios where data must be baked into the bundle during compilation, reducing runtime API calls. Provides retry logic, configurable output paths, and support for multiple fetch targets. Alternatives include custom webpack plugins or using CopyWebpackPlugin with external scripts, but this plugin simplifies the pattern.
npm install fetch-write-webpack-pluginNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configures FetchWritePlugin in webpack.config.js to fetch JSON data from an API and write it to 'static/data.json' at build time.
Ensure the plugin is used in a Node.js environment (e.g., not in webpack-dev-server's in-memory compilation mode if that runs in browser).
Always specify an explicit basePath relative to your project root.
Use a manual rebuild or a different approach if live updates are needed.
Use 'retryOn' as the property name, not 'retryOn'.
Install node-fetch as a dependency: npm install node-fetch
Ensure node-fetch@2 is installed (the plugin has not been tested with v3).
Pass an array of config objects, e.g., new FetchWritePlugin([{...}])