{"id":20075,"library":"grunt-webpack","title":"grunt-webpack","description":"Grunt plugin to run webpack 5 builds and webpack-dev-server as Grunt tasks. Current stable version is 7.0.1 (Nov 2025). Release cadence is irregular with major versions aligned to webpack major releases. Requires Node.js >=18.19.0 and webpack ^5 as peer dependencies. Unlike bare webpack CLI, it integrates into Grunt's task pipeline with support for watch mode, progress output, error handling options, and storing stats for other Grunt tasks. Notable breaking changes: v7 dropped Node 16 and removed special cache handling; v6 dropped webpack 4 and Node 12/14; v5 dropped Node <12.13.","status":"active","version":"7.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/webpack/grunt-webpack","tags":["javascript","gruntplugin","webpack","grunt"],"install":[{"cmd":"npm install grunt-webpack","lang":"bash","label":"npm"},{"cmd":"yarn add grunt-webpack","lang":"bash","label":"yarn"},{"cmd":"pnpm add grunt-webpack","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to run webpack builds","package":"webpack","optional":false},{"reason":"optional peer dependency required for webpack-dev-server task","package":"webpack-dev-server","optional":true}],"imports":[{"note":"Register the plugin in your Gruntfile after installing.","wrong":"require('grunt-webpack');","symbol":"webpack task","correct":"grunt.loadNpmTasks('grunt-webpack');"},{"note":"Configuration goes under 'webpack' key, optionally with targets.","wrong":"grunt.initConfig({ webpack: require('./webpack.config.js') });","symbol":"Gruntfile configuration","correct":"grunt.initConfig({ webpack: { myConfig: require('./webpack.config.js') } });"}],"quickstart":{"code":"// Install: npm install webpack grunt-webpack --save-dev\n// Gruntfile.js\nconst webpackConfig = require('./webpack.config.js');\n\nmodule.exports = function(grunt) {\n  grunt.initConfig({\n    webpack: {\n      options: {\n        stats: !process.env.NODE_ENV || process.env.NODE_ENV === 'development'\n      },\n      prod: Object.assign({}, webpackConfig),\n      dev: Object.assign({ watch: true }, webpackConfig)\n    }\n  });\n\n  grunt.loadNpmTasks('grunt-webpack');\n  grunt.registerTask('default', ['webpack:dev']);\n};","lang":"javascript","description":"Shows how to configure grunt-webpack with two targets (prod and dev) and register the plugin. Assumes a separate webpack.config.js."},"warnings":[{"fix":"Upgrade to Node.js 18.19.0 or higher.","message":"Node.js 16 support removed in v7.0.0.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Upgrade to webpack 5.","message":"webpack 4 support dropped in v6.0.0.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Use webpack's native cache configuration directly.","message":"Special cache configuration handling removed in v7.0.0.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"If you relied on lodash being available, install it separately.","message":"lodash replaced with webpack-merge in v7.0.0.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Upgrade to Node.js 16.13.0+ (now 18+ for v7).","message":"Node.js 12 and 14 support removed in v6.0.0.","severity":"deprecated","affected_versions":">=6.0.0 <7.0.0"},{"fix":"Set keepalive: true in watch mode, or use default (true when watch: true).","message":"Grunt process may hang if watch mode is used without keepalive: true.","severity":"gotcha","affected_versions":">=5.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Add grunt.loadNpmTasks('grunt-webpack'); after grunt.initConfig.","cause":"Plugin not loaded in Gruntfile (missing grunt.loadNpmTasks('grunt-webpack')).","error":"Warning: Task \"webpack\" not found. Use --force to continue."},{"fix":"Run npm install webpack --save-dev (it's a peer dependency).","cause":"webpack not installed or not in node_modules.","error":"Error: Cannot find module 'webpack'"},{"fix":"Ensure grunt.initConfig({ webpack: { myConfig: ... } }) has the target.","cause":"Target name not defined in grunt.initConfig's webpack object.","error":"Error: No configuration found for target: myConfig"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}