Webpack模板使用express
作为开发服务器.那就换一个吧
var server = app.listen(port)
下面的代码是build/dev-server.js
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('/* replace me with key file's location */'),
cert: fs.readFileSync('/* replace me with cert file's location */'))
};
var server = https.createServer(options, app).listen(port);
请注意,在网页包模板中,http://localhost:8080
将使用opn模块在浏览器中自动打开.所以为了方便起见,你最好把var uri = 'http://localhost:' + port
换成var uri = 'https://localhost:' + port
.