{"id":15390614,"url":"https://github.com/solidzoro/gen-buildinfo-webpack-plugin","last_synced_at":"2026-04-19T04:33:19.960Z","repository":{"id":57245877,"uuid":"445756041","full_name":"SolidZORO/gen-buildinfo-webpack-plugin","owner":"SolidZORO","description":"Generate a buildinfo.json file to public directory.","archived":false,"fork":false,"pushed_at":"2023-10-09T07:29:39.000Z","size":36,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-03T04:33:56.861Z","etag":null,"topics":["buildinfo","cra","craco","generate","nextjs","plugin","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/SolidZORO.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}},"created_at":"2022-01-08T07:40:46.000Z","updated_at":"2025-02-20T00:13:57.000Z","dependencies_parsed_at":"2024-10-18T21:18:02.898Z","dependency_job_id":null,"html_url":"https://github.com/SolidZORO/gen-buildinfo-webpack-plugin","commit_stats":{"total_commits":21,"total_committers":1,"mean_commits":21.0,"dds":0.0,"last_synced_commit":"28aa7c2c3d0ff266695e6ee2a910b8f125522f73"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidZORO%2Fgen-buildinfo-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidZORO%2Fgen-buildinfo-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidZORO%2Fgen-buildinfo-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidZORO%2Fgen-buildinfo-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SolidZORO","download_url":"https://codeload.github.com/SolidZORO/gen-buildinfo-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245938228,"owners_count":20697008,"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":["buildinfo","cra","craco","generate","nextjs","plugin","webpack","webpack-plugin"],"created_at":"2024-10-01T15:07:14.048Z","updated_at":"2026-04-19T04:33:19.905Z","avatar_url":"https://github.com/SolidZORO.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gen-buildinfo-webpack-plugin\n\n[![version][npm-img]][npm-url]\n[![license][mit-img]][mit-url]\n[![size][size-img]][size-url]\n[![download][download-img]][download-url]\n\nGenerate a buildinfo.json file to public directory.\n\n\n## Installation\n\n```sh\n# Webpack (CRA)\nyarn add -D gen-buildinfo-webpack-plugin\n \n# Next.js\nyarn add gen-buildinfo-webpack-plugin \n```\n\n\n## Usage\n\n### Webpack (CRA)\n\n```javascript\n// webpack.config.js\nconst GenBuildinfoWebpackPlugin = require('gen-buildinfo-webpack-plugin');\n\nnew GenBuildinfoWebpackPlugin({\n  package: require('./package.json'),\n  //\n  // [Options]\n  // fileDir: PROJECT_PUBLIC_DIR,\n  // fileName: 'buildinfo.json',\n  // commitHashLength: 4, \n})\n```\n\n### Next.js\n\n```javascript\n// next.config.js\n// use `process.env.NEXT_PUBLIC_BUILD_INFO`\nconst { getBuildInfo } = require('gen-buildinfo-webpack-plugin');\n\nmodule.exports = {\n  env: {\n    NEXT_PUBLIC_BUILD_INFO: JSON.stringify(\n      getBuildInfo({ package: require('./package.json') }),\n    ),\n  },\n  webpack(webpackConfig) {\n    return webpackConfig;\n  },\n  // ....\n}\n```\n\n## Output\n\n```js\nconst { getBuildInfo } = require('gen-buildinfo-webpack-plugin');\n\n// {\n//   \"PKG_NAME\": \"demo\",\n//   \"AUTHOR\": \"Jason Feng \u003csolidzoro[#]live.com\u003e\",\n//   \"VERSION\": \"2.66.1\",\n//   \"BUILD_NUMBER\": 2066001,\n//   \"BUILD_TIME\": \"20230406-142929\",\n//   \"COMMIT_HASH\": \"c6ed\"\n// };\nconst buildInfo = getBuildInfo({ package: require('../../package.json') });\n```\n\n\n## License\n\nMIT © [Jason Feng][author-url]\n\n\u003c!-- badges --\u003e\n\n[author-url]: https://github.com/SolidZORO\n\n\n[mit-img]: https://img.shields.io/npm/l/gen-buildinfo-webpack-plugin.svg?style=flat\u0026colorA=000000\u0026colorB=000000\n\n[mit-url]: ./LICENSE\n\n\n[npm-img]: https://img.shields.io/npm/v/gen-buildinfo-webpack-plugin?style=flat\u0026colorA=000000\u0026colorB=000000\n\n[npm-url]: https://www.npmjs.com/package/gen-buildinfo-webpack-plugin\n\n\n[size-img]: https://img.shields.io/bundlephobia/minzip/gen-buildinfo-webpack-plugin?label=bundle\u0026style=flat\u0026colorA=000000\u0026colorB=000000\n\n[size-url]: https://www.npmjs.com/package/gen-buildinfo-webpack-plugin\n\n\n[download-img]: https://img.shields.io/npm/dt/gen-buildinfo-webpack-plugin.svg?style=flat\u0026colorA=000000\u0026colorB=000000\n\n[download-url]: https://www.npmjs.com/package/gen-buildinfo-webpack-plugin\n\n\n[build-img]: https://github.com/SolidZORO/gen-buildinfo-webpack-plugin/workflows/badge.svg\n\n[build-url]: https://github.com/SolidZORO/gen-buildinfo-webpack-plugin/actions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidzoro%2Fgen-buildinfo-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolidzoro%2Fgen-buildinfo-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidzoro%2Fgen-buildinfo-webpack-plugin/lists"}