Learn how to use the new Webpack Dashboard from Formidable Labs to display a pretty, useful output for monitoring the status of your webpack builds. This command line tool replaces the frequently unhelpful large text dump that webpack generates with a pretty user interface that breaks out useful information and presents it in a way that's easy to understand at a glance.

webpack-middleware:

  1. var path = require('path');
  2. var express = require('express');
  3. var webpack = require('webpack');
  4. var config = require('./webpack.config');
  5.  
  6. var Dashboard = require("webpack-dashboard");
  7. var DashboardPlugin = require("webpack-dashboard/plugin");
  8.  
  9. var app = express();
  10. var compiler = webpack(config);
  11.  
  12. var dashboard = new Dashboard();
  13. compiler.apply(new DashboardPlugin(dashboard.setData));
  14.  
  15. app.use(express.static('public'));
  16. app.use(require('webpack-dev-middleware')(compiler, {
  17. quiet: true
  18. }));
  19.  
  20. app.listen(8080, "127.0.0.1", function(err) {
  21. if (err) {
  22. console.log(err);
  23. return;
  24. }
  25.  
  26. console.log('Listening at http://localhost:8080');
  27. });

webpack-dev-server:

  1. var Dashboard = require('webpack-dashboard');
  2. var DashboardPlugin = require('webpack-dashboard/plugin');
  3. var dashboard = new Dashboard();
  4.  
  5. module.exports = {
  6. entry: './main.js',
  7. output: {
  8. path: './',
  9. filename: "index.js"
  10. },
  11. devServer: {
  12. inline: true,
  13. port: 3336,
  14. quite: true, // Add quite option for webpack dashboard
  15. },
  16. module: {
  17. loaders: [
  18. {
  19. test: /\.jsx?$/,
  20. exclude: /(node_modules|bower_components)/,
  21. loader: 'babel',
  22. query: {
  23. presets: ['es2015', 'react']
  24. }
  25. }
  26. ]
  27. },
  28. plugins: [
  29. new DashboardPlugin(dashboard.setData)
  30. ]
  31. };

[Webpack] Use the Webpack Dashboard to Monitor Webpack Operations的更多相关文章

  1. webpack入门(二)what is webpack

    webpack is a module bundler.webpack是一个模块打包工具,为了解决上篇一提到的各种模块加载或者转换的问题. webpack takes modules with dep ...

  2. Webpack+React项目入门——入门及配置Webpack

    一.入门Webpack 参考文章:<入门Webpack,看这篇就够了> 耐心看完这篇非常有帮助 二.React+Webpack环境配置 参考文章:<webpack+react项目初体 ...

  3. webpack构建多页面react项目(webpack+typescript+react)

    目录介绍 src:里面的每个文件夹就是一个页面,页面开发相关的组件.图片和样式文件就存放在对应的文件夹下. tpl:里面放置模板文件,当webpack打包时为html-webpack-plugin插件 ...

  4. webpack安装低于4版本(没有配置webpack.config.js)

    webpack安装低于4版本(没有配置webpack.config.js) webpack 无需配置输出参数-o 低版本  1.初始化项目 npm init -y 初始化项目 2.安装webpack@ ...

  5. Webpack学习笔记一:What is webpack

      #,Loaders干嘛的,webpack can only process JavaScript natively, but loaders are used to transform other ...

  6. webpack笔记_(2)_Refusing to install webpack as a dependency of itself

    安装webpack时,出现以下问题: Refusing to install webpack as a dependency of itself npm ERR! Windows_NT npm ERR ...

  7. webpack需要全局安装,才能使用webpack命令

    webpack全局安装,具体项目中才能使用webpack命令: npm install webpack -g

  8. [Webpack 2] Expose modules to dependencies with Webpack

    When you have a dependency that has dependencies on global variables (like jQuery or lodash) or assu ...

  9. [Webpack 2] Grouping vendor files with the Webpack CommonsChunkPlugin

    Often, you have dependencies which you rarely change. In these cases, you can leverage the CommonsCh ...

随机推荐

  1. bzoj4028

    一眼分块题…… 分块,维护每个块的总的gcd和xor和 先思考我们应该怎么查询,考虑到gcd是一个神奇的东西,因为它最多变化logX次 于是我们从前往后扫描每个块,如果一个块内总的gcd是当前扫描的前 ...

  2. bzoj1453

    这是一道好题,按行建线段树,每个点维护上下边界的连通性,详细见代码注释 网上写法不一,自认为比较简单,就放出来相出来献丑吧 ..,..] of longint; //u[]上边界,d[]下边界 s,f ...

  3. mvc源码解读(20)-controller和view之查找view

    很多时候在mvc项目中我们需要去扩展自己的视图引擎,大概看起来应该下面这个样子的: public class RazorEngineExpand : RazorViewEngine { private ...

  4. POJ3691DNA repair

    题解: 构建出trie图,令f[i][j]表示到第i个字符走到j号节点最少需要修改的字符数,然后枚举后继节点转移即可. 代码:没写caseWA了n发... #include<cstdio> ...

  5. UDP编程(八)

    此为网络编程系列的目录,后续会把内容补上.......

  6. PHP错误:Forbidden You don't have permission to access / on this server.

    今天在测试一个php程序的时候,发现这个问题: Forbidden You don't have permission to access / on this server. 开始的时候我是用http ...

  7. LA3942-Remember the Word(Trie)

    题意: 有s个不同的单词,给出一个长字符串把这个字符串分解成若干个单词的连接(可重复使用),有多少种分解方法 分析: dp[i]表示i开始的字符串能分解的方法数 dp[i]=sum(dp[i+len( ...

  8. sonar之安装篇

    sonar 是一个很好的质量度量平台,安装方式有很多种.下面我教大家使用j2ee 容器的方式安装,我们使用tomcat 1.准备: 1.1 环境redhat linux1.2 下载sonar 从htt ...

  9. 二维坐标的平移,旋转,缩放及matlab实现

    本文结合matlab 软件解释二维坐标系下的平移,旋转,缩放 首先确定点在二维坐标系下的表达方法,使用一个1*3矩阵: Pt = [x,y,1] 其中x,y 分别为点的X,Y坐标,1为对二维坐标的三维 ...

  10. eclipse 项目报错问题

    所有的问题在windoes-->show view--->Problems里查看