{"id":20536,"library":"save-remote-file-webpack-plugin","title":"save-remote-file-webpack-plugin","description":"Webpack 4 plugin that downloads remote files (e.g., analytics.js) during the build process and saves them locally with content hashes for cache busting. Version 1.1.0 is the latest stable release, offering a `hash` option to toggle content hashing. It integrates with `manifest-webpack-plugin` by emitting downloaded files. Designed for developers needing to self-host external scripts without manual downloads or build hooks.","status":"maintenance","version":"1.1.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/nystudio107/save-remote-file-webpack-plugin","tags":["javascript"],"install":[{"cmd":"npm install save-remote-file-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add save-remote-file-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add save-remote-file-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin targets webpack 4","package":"webpack","optional":false},{"reason":"Used to download remote files without temporary disk storage","package":"download","optional":false}],"imports":[{"note":"Plugin is CommonJS only; ESM import does not work unless transpiled or using bundler resolution.","wrong":"import SaveRemoteFilePlugin from 'save-remote-file-webpack-plugin';","symbol":"SaveRemoteFilePlugin","correct":"const SaveRemoteFilePlugin = require('save-remote-file-webpack-plugin');"},{"note":"Do not use named export; the plugin is exported as default, not named.","wrong":"const { SaveRemoteFilePlugin } = require('save-remote-file-webpack-plugin');","symbol":"SaveRemoteFilePlugin","correct":"const { default: SaveRemoteFilePlugin } = require('save-remote-file-webpack-plugin');"},{"note":"Constructor expects an array of option objects, even for a single file.","wrong":"new SaveRemoteFilePlugin({ url: '...', filepath: '...' })","symbol":"SaveRemoteFilePlugin","correct":"new SaveRemoteFilePlugin([{ url: '...', filepath: '...' }])"}],"quickstart":{"code":"const SaveRemoteFilePlugin = require('save-remote-file-webpack-plugin');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  plugins: [\n    new SaveRemoteFilePlugin([\n      {\n        url: 'https://example.com/external.js',\n        filepath: 'js/external.js',\n        hash: true,\n      },\n    ]),\n  ],\n};","lang":"javascript","description":"Shows how to require and configure the plugin in a webpack 4 config, downloading one remote file with content hashing enabled."},"warnings":[{"fix":"Update to version 1.0.1 or later: npm install save-remote-file-webpack-plugin@latest","message":"In version 1.0.0, files were saved without content hashes. Upgrade to >=1.0.1 for hash support.","severity":"breaking","affected_versions":"<=1.0.0"},{"fix":"Wrap single config in an array: new SaveRemoteFilePlugin([{ url: '...', filepath: '...' }])","message":"The plugin expects an array of option objects, even for a single file. Passing an object will cause an error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use require('save-remote-file-webpack-plugin') directly, not { SaveRemoteFilePlugin }.","message":"The imported module is the default export, not a named export. Destructuring will result in undefined.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider using webpack 5 compatible alternatives or migrate to fetch in build scripts.","message":"Plugin is designed for webpack 4 only; not guaranteed to work with webpack 5 due to internal API changes.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use const SaveRemoteFilePlugin = require('save-remote-file-webpack-plugin');","cause":"Using named import via destructuring, which returns undefined.","error":"TypeError: SaveRemoteFilePlugin is not a constructor"},{"fix":"Wrap option in array: new SaveRemoteFilePlugin([{ url: '...', filepath: '...' }])","cause":"Passing a single object instead of an array to the constructor.","error":"Error: options must be an array"},{"fix":"Install the 'download' package: npm install download","cause":"Missing dependency 'download' which is required at runtime.","error":"Error: Cannot find module 'download'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}