{"id":13452051,"url":"https://github.com/sindresorhus/add-asset-webpack-plugin","last_synced_at":"2025-04-06T10:11:41.822Z","repository":{"id":54446756,"uuid":"113393459","full_name":"sindresorhus/add-asset-webpack-plugin","owner":"sindresorhus","description":"Dynamically add an asset to the Webpack graph","archived":false,"fork":false,"pushed_at":"2024-04-30T09:57:51.000Z","size":16,"stargazers_count":97,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T08:11:12.346Z","etag":null,"topics":["javascript","nodejs","npm-package","webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":"","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/sindresorhus.png","metadata":{"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"},"files":{"readme":"readme.md","changelog":null,"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}},"created_at":"2017-12-07T02:42:30.000Z","updated_at":"2025-01-07T20:11:32.000Z","dependencies_parsed_at":"2024-11-06T00:01:54.108Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/add-asset-webpack-plugin","commit_stats":{"total_commits":16,"total_committers":5,"mean_commits":3.2,"dds":0.25,"last_synced_commit":"c1599b038a14f844e195dcb23f026c0eb63c97a5"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fadd-asset-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fadd-asset-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fadd-asset-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fadd-asset-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/add-asset-webpack-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246759498,"owners_count":20829108,"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","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":["javascript","nodejs","npm-package","webpack","webpack-plugin"],"created_at":"2024-07-31T07:01:11.326Z","updated_at":"2025-04-06T10:11:41.805Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["JavaScript"],"sub_categories":[],"readme":"# add-asset-webpack-plugin\n\n\u003e Dynamically add an asset to the [Webpack](https://webpack.js.org) graph\n\n## Install\n\n```sh\nnpm install add-asset-webpack-plugin\n```\n\n## Usage\n\n```js\nimport AddAssetPlugin from 'add-asset-webpack-plugin';\n\nexport default {\n\t// …\n\tplugins: [\n\t\tnew AddAssetPlugin('file.js', `\n\t\t\tconsole.log('This is a dynamically created file');\n\t\t`)\n\t]\n};\n```\n\n## API\n\n### AddAssetPlugin(filePath, source)\n\n#### filePath\n\nType: `string`\n\nRelative file path for the asset.\n\n#### source\n\nType: `string | (compilation =\u003e string | Promise\u003cstring\u003e)`\n\nAsset source or a function that returns the asset source.\n\nIf a function, it will receive the [`compilation` instance](https://webpack.js.org/api/compilation/). And if the function returns a promise, it will be awaited.\n\n## Related\n\n- [node-env-webpack-plugin](https://github.com/sindresorhus/node-env-webpack-plugin) - Simplified `NODE_ENV` handling\n- [add-module-exports-webpack-plugin](https://github.com/sindresorhus/add-module-exports-webpack-plugin) - Add `module.exports` for Babel and TypeScript compiled code\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fadd-asset-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fadd-asset-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fadd-asset-webpack-plugin/lists"}