{"id":15628048,"url":"https://github.com/sibiraj-s/copy-asset-in-memory-webpack-plugin","last_synced_at":"2025-08-02T01:10:32.091Z","repository":{"id":42524939,"uuid":"310883508","full_name":"sibiraj-s/copy-asset-in-memory-webpack-plugin","owner":"sibiraj-s","description":"Copy assets in webpack memory","archived":false,"fork":false,"pushed_at":"2025-02-26T09:00:38.000Z","size":1290,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-30T12:44:40.041Z","etag":null,"topics":["copy-webpack-plugin","webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":"https://npm.im/copy-asset-in-memory-webpack-plugin","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sibiraj-s.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["sibiraj-s"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2020-11-07T16:16:17.000Z","updated_at":"2025-02-26T09:00:42.000Z","dependencies_parsed_at":"2024-10-20T14:20:49.837Z","dependency_job_id":"f4331f40-91d3-417e-a12e-d2a873c26829","html_url":"https://github.com/sibiraj-s/copy-asset-in-memory-webpack-plugin","commit_stats":{"total_commits":76,"total_committers":3,"mean_commits":"25.333333333333332","dds":0.09210526315789469,"last_synced_commit":"573046ddbf6270880e72557e5616ff03521e1339"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/sibiraj-s/copy-asset-in-memory-webpack-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibiraj-s%2Fcopy-asset-in-memory-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibiraj-s%2Fcopy-asset-in-memory-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibiraj-s%2Fcopy-asset-in-memory-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibiraj-s%2Fcopy-asset-in-memory-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sibiraj-s","download_url":"https://codeload.github.com/sibiraj-s/copy-asset-in-memory-webpack-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibiraj-s%2Fcopy-asset-in-memory-webpack-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268322414,"owners_count":24231819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["copy-webpack-plugin","webpack","webpack-plugin"],"created_at":"2024-10-03T10:20:40.217Z","updated_at":"2025-08-02T01:10:32.062Z","avatar_url":"https://github.com/sibiraj-s.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sibiraj-s"],"categories":[],"sub_categories":[],"readme":"# copy-asset-in-memory-webpack-plugin\n\n[![Tests](https://github.com/sibiraj-s/copy-asset-in-memory-webpack-plugin/workflows/Tests/badge.svg)](https://github.com/sibiraj-s/copy-asset-in-memory-webpack-plugin/actions)\n[![License](https://badgen.net/github/license/sibiraj-s/copy-asset-in-memory-webpack-plugin)](https://github.com/sibiraj-s/copy-asset-in-memory-webpack-plugin)\n[![Version](https://badgen.net/npm/v/copy-asset-in-memory-webpack-plugin)](https://npmjs.com/copy-asset-in-memory-webpack-plugin)\n[![Node Version](https://badgen.net/npm/node/copy-asset-in-memory-webpack-plugin)](https://npmjs.com/copy-asset-in-memory-webpack-plugin)\n[![Webpack Version](https://badgen.net/badge/webpack/%3E=5%2E20/orange)](https://webpack.js.org/)\n\n\u003e Copy assets in webpack memory\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/sibiraj-s/copy-asset-in-memory-webpack-plugin\"\u003e\n    \u003cimg width=\"200\" height=\"200\" src=\"./assets/webpack.png\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Getting Started\n\n### Installation\n\n```bash\nnpm i -D copy-asset-in-memory-webpack-plugin\n# or\nyarn add --dev copy-asset-in-memory-webpack-plugin\n```\n\n### Usage\n\n```js\n// webpack.config.js\nconst CopyAssetInMemoryPlugin = require(\"copy-asset-in-memory-webpack-plugin\");\n\nmodule.exports = {\n  plugins: [\n    new CopyAssetInMemoryPlugin({\n      test: /.js$/,\n      to: \"js\",\n    }),\n  ],\n};\n```\n\n### Options\n\n#### test\n\nInclude all assets that pass test assertion\n\nType: `String|RegExp|Array\u003cString|RegExp\u003e`. Default: `undefined`\n\n#### include\n\nInclude all assets matching any of these conditions\n\nType: `String|RegExp|Array\u003cString|RegExp\u003e`. Default: `undefined`\n\n#### exclude\n\nExclude all assets matching any of these conditions\n\nType: `String|RegExp|Array\u003cString|RegExp\u003e`. Default: `undefiend`\n\n#### stage\n\nRefer https://webpack.js.org/api/compilation-hooks/#processassets for more info.\n\n```js\n// webpack.config.js\nconst { Compilation } = require(\"webpack\");\nconst CopyAssetInMemoryPlugin = require(\"copy-asset-in-memory-webpack-plugin\");\n\nmodule.exports = {\n  plugins: [\n    new CopyAssetInMemoryPlugin({\n      test: /.js$/,\n      stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE, // Default\n      to: (fileName) =\u003e `${js}/filename`,\n    }),\n  ],\n};\n```\n\n#### to\n\nAsset destination, allows to modify the file path.\n\nType: `Function | string`. Default: `undefined`\n\n```js\n// webpack.config.js\nconst CopyAssetInMemoryPlugin = require(\"copy-asset-in-memory-webpack-plugin\");\n\nmodule.exports = {\n  plugins: [\n    new CopyAssetInMemoryPlugin({\n      test: /.js$/,\n      to: (fileName) =\u003e `${js}/filename`, // copies all files into `js` folder\n    }),\n    new CopyAssetInMemoryPlugin({\n      test: /.svg$/,\n      to: \"assets\", // copies all files into `assets` folder\n    }),\n  ],\n};\n```\n\n#### transform\n\nAllows to modify the file contents.\n\nType: `Function`. Default: `undefined`\n\n```js\n// webpack.config.js\nconst CopyAssetInMemoryPlugin = require(\"copy-asset-in-memory-webpack-plugin\");\n\nmodule.exports = {\n  plugins: [\n    new CopyAssetInMemoryPlugin({\n      test: /.js$/,\n      to: (fileName) =\u003e `${js}/filename`,\n      // The `content` argument is a [`Buffer`](https://nodejs.org/api/buffer.html) object\n      // it could be converted to a `String` to be processed using `content.toString()`\n      transform: (content) =\u003e \"newContent\",\n    }),\n  ],\n};\n```\n\n#### deleteOriginalAssets\n\nWhether to delete the original assets or not.\n\nType: `boolean`. Default: `false`\n\n### Caveats\n\n- assets cannot be copied outside output directory\n- deleting an asset via `deleteOriginalAssets` will also delete its sourcemap\n\n### Related Plugins\n\n- [replace-asset-name-webpack-plugin](https://github.com/sibiraj-s/replace-asset-name-webpack-plugin)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsibiraj-s%2Fcopy-asset-in-memory-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsibiraj-s%2Fcopy-asset-in-memory-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsibiraj-s%2Fcopy-asset-in-memory-webpack-plugin/lists"}