Home > Article > Web Front-end > How to modify the port number in vue project
Method: 1. Modify the "port" item in the "config\index.js" folder. "port" means the port number. This method can permanently modify the VUE project startup port number; 2 , use "module.exports={devServer:{port:port number,}" to modify.
The operating environment of this article: Windows 10 system, Vue version 2.9.6, DELL G3 computer.
1.Vue 2.x
There is an index.js in the config folder, part of which is as follows, port That is the port number, you can change it here.
module.exports = { dev: { env: require('./dev.env'), port: 8080, // 端口号 assetsSubDirectory: 'static', assetsPublicPath: '/', proxyTable: {}, // CSS Sourcemaps off by default because relative paths are "buggy" // with this option, according to the CSS-Loader README // (https://github.com/webpack/css-loader#sourcemaps) // In our experience, they generally work as expected, // just be aware of this issue when enabling this option. cssSourceMap: false, } };
2.Vue 3.x
#To modify the port number in Vue 3.x, you need to Create a vue.config.js in the project root directory with the following content.
module.exports = { devServer: { port: 8080, // 端口号 } };
[Related recommendations: "vue.js tutorial"]
The above is the detailed content of How to modify the port number in vue project. For more information, please follow other related articles on the PHP Chinese website!