How to change a port number in Vue App

How to change a port number in Vue App

In this post we will give you information about How to change a port number in Vue App. Hear we will give you detail about How to change a port number in Vue AppAnd how to use it also give you demo for it if it is necessary.

we are going to learn how to change a default port number in vue app which is created using the vue cli.

Changing port number

  1. Open the vue app in your favorite code editor.

  2. Create a new file called vue.config.js in your root directory.

  3. Add the following code, by replacing it with your port number.

vue.config.js
module.exports = {    devServer: {        port: 3454    }}
  1. Now, run the app using npm run serve command, your port number is successfully changed.
 DONE  Compiled successfully in 2114ms  App running at:  - Local:   http://localhost:3454/  - Network: http://192.168.43.18:3454/  Note that the development build is not optimized.  To create a production build, run npm run build.

If you want to change the port number temporarily, you can add a –port option to npm run serve command.

Example:

npm run serve -- --port 2345

You can also learn about, how to change a port number in React.

Hope this code and post will helped you for implement How to change a port number in Vue App. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US