{"id":20066413,"url":"https://github.com/itgalaxy/execa-webpack-plugin","last_synced_at":"2025-05-05T18:32:44.673Z","repository":{"id":46948311,"uuid":"115014066","full_name":"itgalaxy/execa-webpack-plugin","owner":"itgalaxy","description":"A better `child_process` for `webpack`","archived":false,"fork":false,"pushed_at":"2023-01-04T21:38:05.000Z","size":3394,"stargazers_count":4,"open_issues_count":19,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-26T18:47:28.985Z","etag":null,"topics":["child-process","command","execa","webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":null,"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/itgalaxy.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}},"created_at":"2017-12-21T14:24:57.000Z","updated_at":"2020-06-01T11:03:04.000Z","dependencies_parsed_at":"2023-02-02T20:45:30.873Z","dependency_job_id":null,"html_url":"https://github.com/itgalaxy/execa-webpack-plugin","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itgalaxy%2Fexeca-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itgalaxy%2Fexeca-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itgalaxy%2Fexeca-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itgalaxy%2Fexeca-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itgalaxy","download_url":"https://codeload.github.com/itgalaxy/execa-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224461873,"owners_count":17315116,"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":["child-process","command","execa","webpack","webpack-plugin"],"created_at":"2024-11-13T13:57:02.895Z","updated_at":"2024-11-13T13:57:03.612Z","avatar_url":"https://github.com/itgalaxy.png","language":"JavaScript","readme":"# execa-webpack-plugin\n\n[![NPM version](https://img.shields.io/npm/v/execa-webpack-plugin.svg)](https://www.npmjs.org/package/execa-webpack-plugin)\n[![Build Status](https://github.com/itgalaxy/execa-webpack-plugin/workflows/CI/badge.svg)](https://github.com/itgalaxy/execa-webpack-plugin/actions)\n[![dependencies Status](https://david-dm.org/itgalaxy/execa-webpack-plugin/status.svg)](https://david-dm.org/itgalaxy/execa-webpack-plugin)\n[![devDependencies Status](https://david-dm.org/itgalaxy/execa-webpack-plugin/dev-status.svg)](https://david-dm.org/itgalaxy/execa-webpack-plugin?type=dev)\n\nA better `child_process` for `webpack`.\n\n## Installation\n\n```shell\nnpm i -D execa-webpack-plugin\n```\n\n## Usage\n\n**webpack.config.js**\n\n```js\nconst ExecaPlugin = require(\"execa-webpack-plugin\");\n\nmodule.exports = {\n  plugins: [\n    new ExecaPlugin({\n      onBeforeRun: [\n        {\n          args: [\"build\"],\n          cmd: \"del\",\n          options: {\n            cwd: process.cwd()\n          }\n        }\n      ]\n    })\n  ]\n};\n```\n\nNote: [list of command options](https://github.com/sindresorhus/execa#options).\n\n## Options\n\n|         Name         |    Type     |         Default         | Description                                                                                                                                   |\n| :------------------: | :---------: | :---------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------- |\n| **`on(NameOfHook)`** |  `{Array}`  |          `[]`           | Array of commands to execute on the hook.                                                                                                     |  |\n|      **`bail`**      | `{Boolean}` | `compiler.options.bail` | Report the first error as a hard error instead of tolerating it.                                                                              |\n|      **`dev`**       | `{Boolean}` |         `true`          | Switch for development environments. This causes scripts to execute once. Useful for running HMR on webpack-dev-server or webpack watch mode. |\n\n### `on(NameOfHook)`\n\nList of [hooks](https://webpack.js.org/api/compiler-hooks/).\nThe name of hook contains: `on` + hook name (first character in upper case).\nExamples: `onBeforeRun`, `onRun`, `onWatchRun`, `onCompile` and etc.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  plugins: [\n    [\n      new ExecaPlugin({\n        onBeforeRun: [\n          {\n            args: [\"build\"],\n            cmd: \"del\"\n          }\n        ],\n        onCompile: [\n          {\n            args: [\"check\"],\n            cmd: \"command\"\n          }\n        ],\n        // Support nested command\n        onDone: [\n          {\n            args: [\n              {\n                args: [\"arg\"],\n                cmd: \"command-return-argument\"\n              },\n              \"other-argument\",\n              {\n                args: [\"arg\"],\n                cmd: \"command-return-other-argument\"\n              }\n            ],\n            cmd: \"command\"\n          }\n        ]\n      })\n    ]\n  ]\n};\n```\n\n### `bail`\n\nFail out on the first error instead of tolerating it. To enable it:\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  plugins: [\n    [\n      new ExecaPlugin({\n        bail: true,\n        onBeforeRun: [\n          {\n            args: [\"build\"],\n            cmd: \"del\"\n          }\n        ]\n      })\n    ]\n  ]\n};\n```\n\n### `dev`\n\nIf you want to run command(s) in `watch` mode every time you can set `dev` option to false.\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  plugins: [\n    new ExecaPlugin({\n      dev: false,\n      onBeforeRun: [\n        {\n          args: [\"build\"],\n          cmd: \"del\"\n        }\n      ]\n    })\n  ]\n};\n```\n\n## Examples\n\n### Set logger level\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  infrastructureLogging: {\n    level: \"warn\"\n  },\n  plugins: [\n    new ExecaPlugin({\n      onBeforeRun: [\n        {\n          args: [\"build\"],\n          cmd: \"del\"\n        }\n      ]\n    })\n  ]\n};\n```\n\n## Thanks\n\n- [execa](https://github.com/sindresorhus/execa) - API.\n\n## [Changelog](CHANGELOG.md)\n\n## [License](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitgalaxy%2Fexeca-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitgalaxy%2Fexeca-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitgalaxy%2Fexeca-webpack-plugin/lists"}