danez / grunt-webpack
Integrate webpack into your grunt build process
AI Architecture Analysis
This repository is indexed by RepoMind. By analyzing danez/grunt-webpack in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.
Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.
Repository Overview (README excerpt)
Crawler view[![npm][npm]][npm-url] Grunt Webpack Use Webpack with Grunt. > The repository was moved out of the webpack organisation as decided in a meeting, and now resides under my personal user account. This is the official repo for the npm package . Requirements • version 5 • (optional) version 5 • Node.js 18.19.0 or newer Install Install this grunt plugin next to your project's Gruntfile.js. You also need to install webpack yourself, this grunt plugin does not install webpack itself. If you also want to use the webpack-dev-server task you also need to install Then add this line to your project's gruntfile: Configuration offers two different tasks and . Both support all webpack options as can be seen in the [webpack documentation][webpack-config]. For exceptions and additions see this list. Both Tasks progress Type: Default: ( if no TTY present) Activates or deactivates the progress output of webpack. Webpack Task failOnError Type: Default: ( if watch mode is used) Will terminate the grunt process when an error happens if set to . If set to the grunt process will not be immediately terminated on error and instead continue to run. keepalive Type: Default: ( if watch mode is used) When set to true the grunt process/task will be kept alive after webpack task is finished. This is especially useful for as this usually needs to run as long as not manually killed. storeStatsTo Type: Default: When set the stats from webpack will be written to a variable with the name provided in this option. The variable can later be used inside of other grunt tasks with template tags . > For more information about grunt template tags have a look at the [grunt docs][grunt-template]. watch Type: Default: > Turn on watch mode. This means that after the initial build, webpack will continue to watch for changes in any of the resolved files. Turning on watch mode also sets the following defaults: • Default to • Default to • Default to Webpack-dev-server Task There are no special options for this task. Some changed defaults for WebpackDevServer options are: | Name | default value | | -------------- | ------------- | | devServer.host | localhost | Examples Webpack imported config This is a simple example that requires the webpack config from the config file. It also disables stats in non 'development' environments and enables watch in development. > The webpack task in this example has two targets called and . They can be renamed to everything besides . See the [grunt docs][grunt-targets] for more information about targets. On the command line you can then do the following. > For more examples and information have a look at the [webpack documentation][webpack-start] which mostly also applies here besides the noted differences above. Lazy config loading In some cases you might want to load the webpack config lazy. This can be done by specifying a function as the config value. The first paramter to this function will be the complete grunt config, which can be used in cases where grunt templates do not work (see below). You could also use a promise Grunt templates grunt-webpack supports grunt templates in all string values in it's configuration. In the next example we use a template for . For plugins we cannot support grunt template interpolation, as plugins are class instances which we cannot modify during runtime without breaking them. If you need to use template in a string option to a plugin, you can use lazy config loading and use the supplied config. You can also use grunt inside directly to access utility methods: Webpack-dev-server imported config This is a simple example that requires the webpack config from the config file. Read how to configure webpack-dev-server in the [webpack-dev-server documentation][webpack-dev-server-config]. > The webpack-dev-server task in this example has one target called . They can be renamed to everything besides . See the [grunt docs][grunt-targets] for more information about targets. On the command line you can then do the following. > For more examples and information have a look at the [webpack documentation]5] which mostly also applies here besides the noted differences above. Troubleshooting Circular reference detected (.plugins) If you encounter this message it means that one of the plugins which are present in your config have circular references. This is not a bug in the plugin and is totally fine for webpack, but sadly grunt cannot handle these. To workaround this problem use lazy config loading, by wrapping your config inside a function. [grunt-template]: http://gruntjs.com/api/grunt.template [webpack-config]: https://webpack.js.org/configuration/ [webpack-dev-server-config]: https://webpack.js.org/configuration/dev-server/ [grunt-targets]: https://gruntjs.com/configuring-tasks#task-configuration-and-targets [webpack-start]: https://webpack.js.org/guides/get-started/ [npm]: https://img.shields.io/npm/v/grunt-webpack.svg [npm-url]: https://npmjs.com/package/grunt-webpack