forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmiddlewareTest.js
56 lines (52 loc) · 1.19 KB
/
middlewareTest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var webpackMiddleware = require("webpack-dev-middleware");
var webpack = require("webpack");
var express = require("express");
var path = require("path");
var app = express();
app.configure(function() {
app.use(webpackMiddleware(webpack({
context: __dirname,
entry: ["../../hot/poll?10000", "./lib/index"],
debug: true,
devtool: "sourcemap",
module: {
loaders: [
{ test: /\.json$/, loader: "json" },
{ test: /\.coffee$/, loader: "coffee" },
{ test: /\.jade$/, loader: "jade" },
{ test: /\.css$/, loader: "style!css" },
{ test: /\.less$/, loader: "style!css!less" },
]
},
resolve: {
alias: {
vm: "vm-browserify"
}
},
resolve: {
unsafeCache: true
},
cache: true,
recordsPath: path.join(__dirname, "webpack.records.json"),
output: {
publicPath: "http://localhost:8080/js/",
path: "/",
filename: "web.js",
chunkFilename: "[chunkhash].chunk.js"
},
plugins: [
new webpack.optimize.UglifyJsPlugin(),
new webpack.HotModuleReplacementPlugin()
]
}), {
lazy: false,
watchDelay: 5000,
publicPath: "/js/",
filename: "web.js",
stats: {
colors: true
}
}));
app.use(express.static(path.join(__dirname)));
});
app.listen(8080);