Explorar o código

use custom server for examples

Evan You %!s(int64=8) %!d(string=hai) anos
pai
achega
316f511f1d
Modificáronse 2 ficheiros con 24 adicións e 2 borrados
  1. 21 0
      examples/server.js
  2. 3 2
      package.json

+ 21 - 0
examples/server.js

@@ -0,0 +1,21 @@
+const express = require('express')
+const webpack = require('webpack')
+const webpackDevMiddleware = require('webpack-dev-middleware')
+const WebpackConfig = require('./webpack.config')
+
+const app = express()
+
+app.use(webpackDevMiddleware(webpack(WebpackConfig), {
+  publicPath: '/__build__/',
+  stats: {
+    colors: true,
+    chunks: false
+  }
+}))
+
+app.use(express.static(__dirname))
+
+const port = process.env.PORT || 8080
+module.exports = app.listen(port, () => {
+  console.log(`Server listening on http://localhost:${port}, Ctrl+C to stop`)
+})

+ 3 - 2
package.json

@@ -9,7 +9,7 @@
     "logger.js"
     "logger.js"
   ],
   ],
   "scripts": {
   "scripts": {
-    "dev": "cd examples && webpack-dev-server --inline --hot --no-info",
+    "dev": "node examples/server.js",
     "test": "eslint src && npm run test:unit && npm run test:e2e",
     "test": "eslint src && npm run test:unit && npm run test:e2e",
     "test:unit": "jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json",
     "test:unit": "jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json",
     "test:e2e": "node test/e2e/runner.js",
     "test:e2e": "node test/e2e/runner.js",
@@ -40,6 +40,7 @@
     "css-loader": "^0.23.1",
     "css-loader": "^0.23.1",
     "eslint": "^2.2.0",
     "eslint": "^2.2.0",
     "eslint-config-vue": "^1.0.0",
     "eslint-config-vue": "^1.0.0",
+    "express": "^4.14.0",
     "jasmine": "^2.4.1",
     "jasmine": "^2.4.1",
     "jasmine-core": "^2.4.1",
     "jasmine-core": "^2.4.1",
     "nightwatch": "^0.9.5",
     "nightwatch": "^0.9.5",
@@ -53,6 +54,6 @@
     "vue": "^2.0.0-beta.5",
     "vue": "^2.0.0-beta.5",
     "vue-loader": "^9.0.3",
     "vue-loader": "^9.0.3",
     "webpack": "^1.12.8",
     "webpack": "^1.12.8",
-    "webpack-dev-server": "^1.12.1"
+    "webpack-dev-middleware": "^1.6.1"
   }
   }
 }
 }