@@ -3,9 +3,8 @@ const express = require('express')
3
3
const webpack = require ( 'webpack' )
4
4
const devMiddleware = require ( 'webpack-dev-middleware' )
5
5
const hotMiddleware = require ( 'webpack-hot-middleware' )
6
-
6
+ const proConfig = require ( '../../config/pro-config' )
7
7
const webpackConfig = require ( './webpack.dev.conf' )
8
-
9
8
const config = require ( '../../config' )
10
9
const port = config . dev . port
11
10
@@ -20,9 +19,9 @@ const main = function () {
20
19
const compiler = webpack ( webpackConfig )
21
20
22
21
const webpackDevMiddleware = devMiddleware ( compiler , {
23
- // logLevel: 'silent',
24
22
index : 'index.html' ,
25
- publicPath : webpackConfig . output . publicPath
23
+ publicPath : webpackConfig . output . publicPath ,
24
+ stats : false
26
25
} )
27
26
28
27
const webpackHotMiddleware = hotMiddleware ( compiler , {
@@ -34,10 +33,7 @@ const main = function () {
34
33
//设置跨域访问
35
34
app . all ( '*' , function ( req , res , next ) {
36
35
res . header ( 'Access-Control-Allow-Origin' , '*' )
37
- // res.header("Access-Control-Allow-Headers", "X-Requested-With");
38
- // res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
39
- // res.header("X-Powered-By",' 3.2.1')
40
- // res.header("Content-Type", "application/json;charset=utf-8");
36
+ res . header ( 'Cache-Control' , 'no-store' )
41
37
next ( )
42
38
} )
43
39
@@ -57,7 +53,7 @@ const main = function () {
57
53
58
54
console . log ( '> Starting dev server...' )
59
55
webpackDevMiddleware . waitUntilValid ( ( ) => {
60
- console . log ( `> Listening at ${ config . dev . host } :${ newPort } \n` )
56
+ console . log ( `> Listening at ${ config . dev . host } :${ proConfig . nodeServerPort } \n` )
61
57
} )
62
58
app . listen ( newPort )
63
59
} )
0 commit comments