22process . env . NODE_ENV = 'development' ;
33
44var express = require ( 'express' ) ;
5- var path = require ( 'path' ) ;
65var chalk = require ( 'chalk' ) ;
76var webpack = require ( 'webpack' ) ;
87var WebpackDevServer = require ( 'webpack-dev-server' ) ;
@@ -12,10 +11,8 @@ var opn = require('opn');
1211var http = require ( 'http' ) ;
1312var proxy = require ( 'http-proxy-middleware' ) ;
1413var httpProxy = require ( 'http-proxy' ) ;
15- var prompt = require ( './utils/prompt' ) ;
1614var config = require ( '../config/webpack.dev' ) ;
1715var paths = require ( '../config/paths' ) ;
18- var env = require ( '../config/env' ) ;
1916
2017// Tools like Cloud9 rely on this.
2118var DEFAULT_PORT = process . env . PORT || 3000 ;
@@ -164,6 +161,13 @@ function openBrowser(port, protocol) {
164161}
165162
166163function addMiddleware ( devServer , index ) {
164+ devServer . use ( function ( req , res , next ) {
165+ if ( req . url === '/' ) {
166+ req . url = '/homepage' ;
167+ }
168+ next ( ) ;
169+ } ) ;
170+ devServer . use ( '/homepage' , express . static ( paths . homepageSrc ) ) ;
167171 devServer . use (
168172 historyApiFallback ( {
169173 // Allow paths with dots in them to be loaded, reference issue #387
@@ -215,6 +219,7 @@ function runDevServer(port, protocol, index) {
215219 // contentBase: paths.staticPath,
216220 host : process . env . LOCAL_SERVER ? 'localhost' : 'codesandbox.dev' ,
217221 disableHostCheck : ! process . env . LOCAL_SERVER ,
222+ contentBase : false ,
218223 } ) ;
219224
220225 // Our custom middleware proxies requests to /index.html or a remote API.
0 commit comments