{"library":"on-build-webpack","title":"Webpack OnBuild Plugin","description":"The `on-build-webpack` package provides a Webpack plugin designed to execute a callback function immediately after a build completes. Published as version `0.1.0` in October 2014, this package is considered abandoned and is not actively maintained. Its functionality is extremely basic, offering a single post-build hook, which contrasts sharply with the extensive `compiler.hooks` API introduced in modern Webpack versions (v4+). This plugin uses an outdated Webpack API (`compiler.plugin('done', ...)`) that has been replaced by the Tapable hook system (`compiler.hooks.done.tap(...)`). Consequently, it is incompatible with Webpack v4 and newer. Current best practice is to use Webpack's native plugin system directly via `compiler.hooks.done.tap` within a custom plugin.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install on-build-webpack"],"cli":null},"imports":["const WebpackOnBuildPlugin = require('on-build-webpack');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const path = require('path');\nconst WebpackOnBuildPlugin = require('on-build-webpack');\n\nmodule.exports = {\n  mode: 'development',\n  entry: './src/index.js',\n  output: {\n    filename: 'bundle.js',\n    path: path.resolve(__dirname, 'dist'),\n  },\n  plugins: [\n    new WebpackOnBuildPlugin(function(stats) {\n      // The 'stats' object contains information about the build.\n      // For modern Webpack, 'stats.hasErrors()' and 'stats.hasWarnings()' are useful.\n      // For this old plugin, the structure of 'stats' might differ.\n      if (stats.hasErrors()) {\n        console.error('Webpack build failed with errors!');\n        console.error(stats.toString({ colors: true }));\n      } else {\n        console.log('Webpack build completed successfully!');\n      }\n    }),\n  ],\n  // Note: This configuration is for demonstration of the plugin's original usage.\n  // It is unlikely to work with modern Webpack (v4+).\n  // For modern Webpack, directly use compiler.hooks.done.tap.\n};\n","lang":"javascript","description":"This quickstart demonstrates how to integrate the `WebpackOnBuildPlugin` into a `webpack.config.js` file to execute a callback after a successful or failed build. It shows basic setup for a project with `src/index.js` as the entry point, bundling to `dist/bundle.js`. Note: This plugin is outdated and likely incompatible with modern Webpack versions (v4 and above).","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}