1. 安装
npm install webpack-dashboard --save-dev
2. 配置说明
webpack config

// Import the plugin:
var DashboardPlugin = require('webpack-dashboard/plugin'); // If you aren't using express, add it to your webpack configs plugins section:
plugins: [
new DashboardPlugin()
] // If you are using an express based dev server, add it with compiler.apply
compiler.apply(new DashboardPlugin()); // if using a custom port, plugins: [
new DashboardPlugin({ port: 3001 })
]
// In the latest version, you can either run your app, and run webpack-dashboard independently (by installing with npm install webpack-dashboard -g) or run webpack-dashboard from your package.json. So if your dev server start script previously looked like: "scripts": {
"dev": "node index.js"
}
// change that to : "scripts": {
"dev": "webpack-dashboard -- node index.js"
}
3. 简单使用(react 项目) 
// 目录结构

├── package.json
├── public
│   ├── index.html
│   └── style.css
├── server.js
├── src
│   └── index.js
└── webpack.config.js // package.json {
"name": "webpack-dashboard-demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node server.js",
"prebuild": "rm -rf dist && mkdir dist && cp public/* dist/",
"build": "webpack",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-core": "^6.13.2",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.13.2",
"babel-preset-react": "^6.11.1",
"react": "^15.3.0",
"react-dom": "^15.3.0",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
},
"devDependencies": {
"webpack-dashboard": "0.0.1"
}
} //server.js var path = require('path');
var express = require('express');
var webpack = require('webpack');
var config = require('./webpack.config'); var Dashboard = require("webpack-dashboard");
var DashboardPlugin = require("webpack-dashboard/plugin"); var app = express();
var compiler = webpack(config); var dashboard = new Dashboard();
compiler.apply(new DashboardPlugin(dashboard.setData)); app.use(express.static('public'));
app.use(require('webpack-dev-middleware')(compiler, {
quiet: true
})); app.listen(8080, "0.0.0.0", function(err) {
if (err) {
console.log(err);
return;
} console.log('Listening at http://0.0.0.0:8080');
}); // webpack.config.js module.exports = {
devtool: "inline-source-map",
entry: __dirname + "/src/index.js",
output: {
filename: "bundle.js",
path: __dirname + "/dist/"
},
devServer: {
contentBase: "public/"
},
module: {
loaders: [
{
test: /\.js$/,
include: __dirname + "/src/",
loader: "babel-loader"
}
]
}
} // index.js import React from 'react';
import reactDOM from 'react-dom'; reactDOM.render(
<div>
<h1>A Webpack Dashboard dalong demo?!</h1>
<p>Thanks, <a href="https://formidable.com/blog/2016/08/15/introducing-webpack-dashboard/">FormidableLabs</a>!</p>
<p>(Check out the source <a href="https://github.com/FormidableLabs/webpack-dashboard">here</a>)</p>
</div>,
document.getElementById('root')
);
4. 启动效果
 
错误实时查看
修改为:
 
实时错误信息
 
 
5. 参考文档
https://github.com/FormidableLabs/webpack-dashboard
 
 
 
 

Webpack-dashboard 简单使用的更多相关文章

  1. 使用webstorm+webpack构建简单入门级“HelloWorld”的应用&&引用jquery来实现alert

    使用webstorm+webpack构建简单入门级"HelloWorld"的应用&&构建使用jquery来实现 1.首先你自己把webstorm安装完成. 请参考这 ...

  2. [Webpack] Use the Webpack Dashboard to Monitor Webpack Operations

    Learn how to use the new Webpack Dashboard from Formidable Labs to display a pretty, useful output f ...

  3. vue.js+webpack在一个简单实例中的使用过程demo

    这里主要记录vue.js+webpack在一个简单实例中的使用过程 说明:本次搭建基于Win 7平台 Node.js 安装官网提供了支持多种平台的的LTS版本下载,我们根据需要来进行下载安装.对于Wi ...

  4. 使用webstorm+webpack构建简单入门级“HelloWorld”的应用&&构建使用jquery来实现

    使用webstorm+webpack构建简单入门级“HelloWorld”的应用&&构建使用jquery来实现 1.首先你自己把webstorm安装完成. 请参考这篇文章进行安装和破解 ...

  5. vue+node+es6+webpack创建简单vue的demo

    闲聊: 小颖之前一直说是写一篇用vue做的简单demo的文章,然而小颖总是给自己找借口,说没时间,这一没时间一下就推到现在了,今天抽时间把这个简单的demo整理下,给大家分享出来,希望对大家也有所帮助 ...

  6. webpack的简单使用

    今天简单的说一下webpack的使用. 打开cmd(也可以用别的看个人爱好) 打开你要创建项目的文件夹: webpack安装: 1.全局安装webpack:$npm install webpack - ...

  7. webpack的简单配置

    本人刚开始也不会写webpack配置,刚开始在网上搜索了了一些,看的也是刚刚理解,所以准备自己写下来,已作纪念和贡献给像我一样不会配置的“童鞋”们! 1.创建webpack配置文件 在项目文件下创建一 ...

  8. webpack 4 简单介绍

    webpack是什么? webpack是一个现代JavaScript应用程序的静态模块打包器(module bundler). 为什么要使用webpack呢? 随着web技术的发展,前端开发不再仅仅是 ...

  9. webpack最简单的入门教程里bundle.js之运行单步调试的原理解析

    读这篇文章的朋友,请确保对webpack有最基础的认识. 您可以阅读我前一篇文章:Webpack 10分钟入门 来在本地运行一个Webpack的hello world项目.https://www.to ...

  10. Node 使用webpack编写简单的前端应用

    编写目的 1. 使用 Node 依赖webpack.jQuery编写简单的前端应用. 操作步骤 (1)新建一个目录 $ mkdir simple-app-demo $ cd simple-app-de ...

随机推荐

  1. jQuery垂直手风琴菜单 菜单项带小图标

    在线演示 本地下载

  2. 在react-native中使用redux

    redux是什么? redux是一个用于管理js应用状态的容器.redux出现时间并不是很长,在它出现之前也有类似功能的模块出现,诸如flux等等.redux设计的理念很简单,似乎最初这个开发团队就有 ...

  3. HttpServletResponse 的 sendError( )方法以及常用的HttpServletResponse常量级错误代码

    HttpServletResponse 的 sendError( )方法以及常用的HttpServletResponse常量级错误代码   转载:http://hi.baidu.com/yanfei_ ...

  4. 深入理解SELECT ... LOCK IN SHARE MODE和SELECT ... FOR UPDATE

    概念和区别 SELECT ... LOCK IN SHARE MODE走的是IS锁(意向共享锁),即在符合条件的rows上都加了共享锁,这样的话,其他session可以读取这些记录,也可以继续添加IS ...

  5. springmvc跨域

    //mvc默认是text/plain;charset=ISO-8859-1@RequestMapping(value = "/xxx", produces = "appl ...

  6. eclipse里启动rabbitmq报错 java.net.SocketException: Connection reset

    RabbitMQ学习之Java客户端连接测试(二) https://blog.csdn.net/roc1029/article/details/51249412 使用guest用户远程连接Rabbit ...

  7. MyBatis使用自定义TypeHandler转换类型

    MyBatis虽然有很好的SQL执行性能,但毕竟不是完整的ORM框架,不同的数据库之间SQL执行还是有差异. 笔者最近在升级 Oracle 驱动至 ojdbc 7 ,就发现了处理DATE类型存在问题. ...

  8. Springer Latex

    What are the guidelines for uploading a LaTeX formatted manuscript?   1. Always upload the main LaTe ...

  9. python函数式编程之返回函数、匿名函数、装饰器、偏函数学习

    python函数式编程之返回函数 高阶函数处理可以接受函数作为参数外,还可以把函数作为结果值返回. 函数作为返回值 def laxy_sum(*args): def sum(): ax = 0; fo ...

  10. CrateDB——全文搜索使用的是lucene,尚不知其底层实现

    CrateDB: The fast, scalable, easy to use SQL database with native full text search https://crate.io ...