webpack - How to run Vue.js dev serve with https? -
i'm using vue-cli create vue project webpack template. how run https in development using: npm run dev
?
webpack template uses express
server development. replace
var server = app.listen(port)
with following code in build/dev-server.js
.
var https = require('https'); var fs = require('fs'); var options = { key: fs.readfilesync('/* replace me key file's location */'), cert: fs.readfilesync('/* replace me cert file's location */')) }; var server = https.createserver(options, app).listen(port);
please note in webpack template, http://localhost:8080
automatically opened in browser using opn module. you'd better replace var uri = 'http://localhost:' + port
var uri = 'https://localhost:' + port
convenience.
wiki
Comments
Post a Comment