Skip to content

Commit

Permalink
开启hot-middlewave 更新readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sanszhu committed May 25, 2018
1 parent 63a81a5 commit b9acfb7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,14 @@ npm run build
# build for production and view the bundle analyzer report
npm run build --report
```

目标实现的功能
1.eslint vmrc eslintignore editorconfig
2.babel配置 postcss/pretty.js(待补充)
3.static文件夹为静态文件模板/config为配置参数
4.dev-server /hot -module/ less (BEM )/babel
5.code split 大文件单独异步import /common trunk 公共文件单独vendor runtime单独vendor / cssnano

todo
1.用lerma做私有包管理
2.整合到vue-cli的脚手架中
18 changes: 10 additions & 8 deletions build/dev-server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
require('./check-versions')()

var config = require('../config')
if (!process.env.NODE_ENV) {
process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
}
var fs = require('fs-extra');
var path = require('path')
var express = require('express')
Expand All @@ -12,16 +8,20 @@ var proxyMiddleware = require('http-proxy-middleware')
var webpackConfig = require('./webpack.dev.conf')
var bodyParser = require('body-parser')

var config = require('../config')

if (!process.env.NODE_ENV) {
process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
}

var devPath = path.resolve(__dirname, '../dev');
// default port where dev server listens for incoming traffic
var port = process.env.PORT || config.dev.port
// automatically open browser, if not set will be false
var autoOpenBrowser = !!config.dev.autoOpenBrowser

// Define HTTP proxies to your custom API backend
// https://github.com/chimurai/http-proxy-middleware
var proxyTable = config.dev.proxyTable


var app = express()
var server = require('http').createServer(app);

Expand All @@ -33,6 +33,8 @@ var devMiddleware = require('webpack-dev-middleware')(compiler, {
quiet: true
})



var hotMiddleware = require('webpack-hot-middleware')(compiler, {
log: () => {}
})
Expand Down Expand Up @@ -74,7 +76,7 @@ app.use(devMiddleware)

// enable hot-reload and state-preserving
// compilation error display
// app.use(hotMiddleware)
app.use(hotMiddleware)


app.use(bodyParser.json()); // for parsing application/json
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nerd",
"version": "0.0.1",
"version": "0.0.2",
"description": "a simple frontend project tempplate\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[C\u001b[C\u001b[-\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D\u001b[D-initial-\u001b[template",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit b9acfb7

Please sign in to comment.