{"id":20646561,"url":"https://github.com/tienne/webpack-hook-plugin","last_synced_at":"2025-07-02T17:34:42.036Z","repository":{"id":34867748,"uuid":"185643422","full_name":"tienne/webpack-hook-plugin","owner":"tienne","description":"run any shell commands before or after webpack builds (with type definition)","archived":false,"fork":false,"pushed_at":"2023-01-05T01:42:36.000Z","size":1542,"stargazers_count":33,"open_issues_count":21,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-17T23:24:13.647Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tienne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-08T16:32:59.000Z","updated_at":"2024-10-14T22:58:42.000Z","dependencies_parsed_at":"2023-01-15T09:44:12.619Z","dependency_job_id":null,"html_url":"https://github.com/tienne/webpack-hook-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tienne/webpack-hook-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tienne%2Fwebpack-hook-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tienne%2Fwebpack-hook-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tienne%2Fwebpack-hook-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tienne%2Fwebpack-hook-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tienne","download_url":"https://codeload.github.com/tienne/webpack-hook-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tienne%2Fwebpack-hook-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260466483,"owners_count":23013514,"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":[],"created_at":"2024-11-16T16:26:17.325Z","updated_at":"2025-07-02T17:34:42.012Z","avatar_url":"https://github.com/tienne.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webpack Hook Plugin\n\nThis plugin allows you to run any shell commands before or after webpack builds. This will work for both webpack and webpack-dev-server.\n\nGoes great with running cron jobs, reporting tools, or tests such as selenium, protractor, phantom, ect.\n\n[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Ftienne%2Fwebpack-hook-plugin)](https://hits.seeyoufarm.com)\n\n## Installation\n\n`npm install --save-dev webpack-hook-plugin`\n\n## Setup\nIn `webpack.config.js`:\n\n```js\nimport WebpackHookPlugin from 'webpack-hook-plugin';\n\nmodule.exports = {\n  //...\n  //...\n  plugins: [\n    new WebpackHookPlugin({\n      onBuildStart:['echo \"Webpack Start\"'],\n      onBuildEnd:['echo \"Webpack End\"']\n    })\n  ],\n  //...\n}\n```\n\n## Example\n\nInsert into your webpack.config.js:\n\n```js\nimport WebpackHookPlugin from 'webpack-hook-plugin';\nconst path = require('path');\n\nvar plugins = [];\n\nplugins.push(new WebpackHookPlugin({\n  onBuildStart: ['echo \"Starting\"'],\n  onBuildEnd: ['python script.py \u0026\u0026 node script.js']\n}));\n\nvar config = {\n  entry: {\n    app: path.resolve(__dirname, 'src/app.js')\n  },\n  output: {\n    path: path.resolve(__dirname, 'dist'), // regular webpack\n    filename: 'bundle.js'\n  },\n  devServer: {\n    contentBase: path.resolve(__dirname, 'src') // dev server\n  },\n  plugins: plugins,\n  module: {\n    loaders: [\n      {test: /\\.js$/, loaders: 'babel'},\n      {test: /\\.scss$/, loader: 'style!css!scss?'},\n      {test: /\\.html$/, loader: 'html-loader'}\n    ]\n  }\n}\n\nmodule.exports = config;\n\n```\nOnce the build finishes, a child process is spawned firing both a python and node script.\n\n### API\n* `onBuildStart`: array of scripts to execute on the initial build. **Default: [ ]**\n* `onBuildEnd`: array of scripts to execute after files are emitted at the end of the compilation. **Default: [ ]**\n* `onBuildExit`: array of scripts to execute after webpack's process is complete. *Note: this event also fires in `webpack --watch` when webpack has finished updating the bundle.* **Default: [ ]**\n* `onCompile`: array of scripts to execute on every compile. **Default: [ ]**\n* `dev`: switch for development environments. This causes scripts to execute once. Useful for running HMR on webpack-dev-server or webpack watch mode. **Default: true**\n* `safe`: switches script execution process from spawn to exec. If running into problems with spawn, turn this setting on. **Default: false**\n\n### Etc\n\nIf this plugin is helpful, please click star to support it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftienne%2Fwebpack-hook-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftienne%2Fwebpack-hook-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftienne%2Fwebpack-hook-plugin/lists"}