@@ -4,7 +4,6 @@ var webpackDevMiddleware = require("webpack-dev-middleware");
4
4
var express = require ( "express" ) ;
5
5
var compress = require ( "compression" ) ;
6
6
var sockjs = require ( "sockjs" ) ;
7
- var StreamCache = require ( "stream-cache" ) ;
8
7
var http = require ( "http" ) ;
9
8
var https = require ( "https" ) ;
10
9
var httpProxyMiddleware = require ( "http-proxy-middleware" ) ;
@@ -35,22 +34,6 @@ function Server(compiler, options) {
35
34
this . _stats = stats ;
36
35
} . bind ( this ) ) ;
37
36
38
- // Prepare live html page
39
- var livePage = this . livePage = new StreamCache ( ) ;
40
- fs . createReadStream ( path . join ( __dirname , ".." , "client" , "live.html" ) ) . pipe ( livePage ) ;
41
-
42
- // Prepare the live js file
43
- var liveJs = new StreamCache ( ) ;
44
- fs . createReadStream ( path . join ( __dirname , ".." , "client" , "live.bundle.js" ) ) . pipe ( liveJs ) ;
45
-
46
- // Prepare the inlined js file
47
- var inlinedJs = new StreamCache ( ) ;
48
- fs . createReadStream ( path . join ( __dirname , ".." , "client" , "index.bundle.js" ) ) . pipe ( inlinedJs ) ;
49
-
50
- // Prepare the sockjs js file
51
- var sockjsJs = new StreamCache ( ) ;
52
- fs . createReadStream ( path . join ( __dirname , ".." , "client" , "sockjs.bundle.js" ) ) . pipe ( sockjsJs ) ;
53
-
54
37
// Init express server
55
38
var app = this . app = new express ( ) ;
56
39
@@ -59,23 +42,23 @@ function Server(compiler, options) {
59
42
60
43
app . get ( "/__webpack_dev_server__/live.bundle.js" , function ( req , res ) {
61
44
res . setHeader ( "Content-Type" , "application/javascript" ) ;
62
- liveJs . pipe ( res ) ;
45
+ fs . createReadStream ( path . join ( __dirname , ".." , "client" , "live.bundle.js" ) ) . pipe ( res ) ;
63
46
} ) ;
64
47
65
48
app . get ( "/__webpack_dev_server__/sockjs.bundle.js" , function ( req , res ) {
66
49
res . setHeader ( "Content-Type" , "application/javascript" ) ;
67
- sockjsJs . pipe ( res ) ;
50
+ fs . createReadStream ( path . join ( __dirname , ".." , "client" , "sockjs.bundle.js" ) ) . pipe ( res ) ;
68
51
} ) ;
69
52
70
53
app . get ( "/webpack-dev-server.js" , function ( req , res ) {
71
54
res . setHeader ( "Content-Type" , "application/javascript" ) ;
72
- inlinedJs . pipe ( res ) ;
55
+ fs . createReadStream ( path . join ( __dirname , ".." , "client" , "index.bundle.js" ) ) . pipe ( res ) ;
73
56
} ) ;
74
57
75
58
app . get ( "/webpack-dev-server/*" , function ( req , res ) {
76
59
res . setHeader ( "Content-Type" , "text/html" ) ;
77
- this . livePage . pipe ( res ) ;
78
- } . bind ( this ) ) ;
60
+ fs . createReadStream ( path . join ( __dirname , ".." , "client" , "live.html" ) ) . pipe ( res ) ;
61
+ } ) ;
79
62
80
63
app . get ( "/webpack-dev-server" , function ( req , res ) {
81
64
res . setHeader ( "Content-Type" , "text/html" ) ;
0 commit comments