Registry / devops / grunt-webpack

grunt-webpack

JSON →
library7.0.1jsnpmunverified

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.

npm install grunt-webpack
INSTALL
IMPORT
SIG · GRUNT-WEBPACK
G
grunt-webpack
devopsjavascriptv7.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

webpack task
grunt.loadNpmTasks('grunt-webpack');
require('grunt-webpack');
Register the plugin in your Gruntfile after installing.
Gruntfile configuration
grunt.initConfig({ webpack: { myConfig: require('./webpack.config.js') } });
grunt.initConfig({ webpack: require('./webpack.config.js') });
Configuration goes under 'webpack' key, optionally with targets.

Shows how to configure grunt-webpack with two targets (prod and dev) and register the plugin. Assumes a separate webpack.config.js.

// Install: npm install webpack grunt-webpack --save-dev // Gruntfile.js const webpackConfig = require('./webpack.config.js'); module.exports = function(grunt) { grunt.initConfig({ webpack: { options: { stats: !process.env.NODE_ENV || process.env.NODE_ENV === 'development' }, prod: Object.assign({}, webpackConfig), dev: Object.assign({ watch: true }, webpackConfig) } }); grunt.loadNpmTasks('grunt-webpack'); grunt.registerTask('default', ['webpack:dev']); };
Debug
Known issues
breakingNode.js 16 support removed in v7.0.0.
fix
Upgrade to Node.js 18.19.0 or higher.
affects: >=7.0.0
breakingwebpack 4 support dropped in v6.0.0.
fix
Upgrade to webpack 5.
affects: >=6.0.0
breakingSpecial cache configuration handling removed in v7.0.0.
fix
Use webpack's native cache configuration directly.
affects: >=7.0.0
breakinglodash replaced with webpack-merge in v7.0.0.
fix
If you relied on lodash being available, install it separately.
affects: >=7.0.0
deprecatedNode.js 12 and 14 support removed in v6.0.0.
fix
Upgrade to Node.js 16.13.0+ (now 18+ for v7).
affects: >=6.0.0 <7.0.0
gotchaGrunt process may hang if watch mode is used without keepalive: true.
fix
Set keepalive: true in watch mode, or use default (true when watch: true).
affects: >=5.0.0
Errors
Common errors & fixes
Warning: Task "webpack" not found. Use --force to continue.
Plugin not loaded in Gruntfile (missing grunt.loadNpmTasks('grunt-webpack')).
fix
Add grunt.loadNpmTasks('grunt-webpack'); after grunt.initConfig.
Error: Cannot find module 'webpack'
webpack not installed or not in node_modules.
fix
Run npm install webpack --save-dev (it's a peer dependency).
Error: No configuration found for target: myConfig
Target name not defined in grunt.initConfig's webpack object.
fix
Ensure grunt.initConfig({ webpack: { myConfig: ... } }) has the target.
Upgrade
Version history
7.0.1latest on npm
Audit
Dependencies
webpackrequiredpeer dependency required to run webpack builds
webpack-dev-serveroptionaloptional peer dependency required for webpack-dev-server task
Agent activity
4 hits · last 30 days
node
4
Resources
grunt-webpack — npm install grunt-webpack · libregistry