How to run Vue.js dev serve with https?

后端 未结 7 980
孤独总比滥情好
孤独总比滥情好 2020-12-07 17:20

I\'m using Vue-cli to create vue project with webpack template. how to run it with https in development using: npm run dev?

7条回答
  •  借酒劲吻你
    2020-12-07 17:54

    In the latest vuejs (as of May 7, 2018), you need to add a "vue.config.js" in the project root directory:

    vue.config.js:

    module.exports = {
      devServer: {
        open: process.platform === 'darwin',
        host: '0.0.0.0',
        port: 8085, // CHANGE YOUR PORT HERE!
        https: true,
        hotOnly: false,
      },
    }
    

    In this file, set the value: https: true

提交回复
热议问题