How to change the port number in a Vue CLI project?

Sometimes, we want to change the port number in a Vue CLI project.

In this article, we’ll look at how to change the port number in a Vue CLI project.

How to change the port number in a Vue CLI project?

To change the port number in a Vue CLI project, we can change the port property in the object being exported in vue.config.js.

For instance, we write

vue.config.js

module.exports = {
  // ...
  devServer: {
    open: process.platform === "darwin",
    host: "0.0.0.0",
    port: 8088,
    https: false,
    hotOnly: false,
  },
  // ...
};

to change the port property to 8088 to server the Vue CLI project on port 8088.

Conclusion

To change the port number in a Vue CLI project, we can change the port property in the object being exported in vue.config.js.