- 关于文档
- 1. 概览
- 开始
- 2.1. 动机
- 2.2. webpack是什么
- 2.3. 安装
- 2.4. 用法
- 2.5. Require Modules
- 2.6. Vendor Modules
- 2.7. 使用 Loaders
- 2.8. 使用 Plugins
- 2.9. 工具
- 2.10. 故障处理
- 教程与例子
- 指南
- webpack with
- Lists
- Development
- 7.1. Changelog
- 7.2. Roadmap
- 7.3. Ideas
- 7.4. Contributing
- Published with GitBook
webpack doc
There is a grunt plugin for using webpack and the [[webpack-dev-server]]: grunt-webpack.
It's pretty simple to use:
module.exports = function(grunt) {grunt.loadNpmTasks("grunt-webpack");grunt.initConfig({webpack: {options: {// configuration for all builds},build: {// configuration for this build}},"webpack-dev-server": {options: {webpack: {// configuration for all builds},// server and middleware options for all builds},start: {webpack: {// configuration for this build},// server and middleware options for this build}}});};
Development
The best option for development is the [[webpack-dev-server]], but it requires spawning a server. If this is not possible or too complex the normal build - watch cycle is possible too.
Example
Take a look at an example Gruntfile. It covers three modes:
- webpack-dev-server
- build - watch cycle
- production build
