Webpack 5 plugin to copy processed assets while the compilation is still in memory, before they are written to disk. Version 4.0.1 is the latest stable, with a history of breaking changes aligning with webpack 5. It allows filtering by test/include/exclude, renaming via `to`, transforming content, and optionally deleting original assets. Unlike copy-webpack-plugin which copies from filesystem to output, this plugin copies assets already in webpack's compilation graph. Requires webpack ^5.20.0 and Node >=12.13. Ships TypeScript types.
npm install copy-asset-in-memory-webpack-pluginVerified import paths — ran on the pinned version, not inferred.
Shows CommonJS usage in webpack.config.js, copying .js assets to a 'scripts' subfolder in memory.
Upgrade webpack to ^5.20.0. If stuck on webpack 4, use v3.x.
Ensure the `to` option produces paths relative to the output directory. Do not use absolute paths or '..'.
If you need source maps, either disable deleteOriginalAssets or manually copy the source map before deletion.
Explicitly set stage to Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL for forward compatibility.
Run `npm install -D copy-asset-in-memory-webpack-plugin` and ensure your webpack config is in a directory where node_modules can be resolved.
Use `const CopyAssetInMemoryPlugin = require('copy-asset-in-memory-webpack-plugin');` in CommonJS, or `import CopyAssetInMemoryPlugin from 'copy-asset-in-memory-webpack-plugin';` in ESM (with appropriate configuration).Use `Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE` (default) or another valid stage from webpack's Compilation object.
Upgrade Node.js to version >=12.13.