Home>Article>Web Front-end> How to change the port number in vue.js
How to change the port number in vue.js: 1. There is an [index.js] in the config folder, part of which is as follows, port is the port number, change it here; 2. [Vue 3.x ] To modify the port number, you need to create a [vue.config.js] in the project root directory.
The operating environment of this tutorial: windows10 system, vue2.9, this article is applicable to all brands of computers.
【Recommended related articles:vue.js】
How to change the port number in vue.js:
1.Vue 2.x
There is an index.js in the config folder, part of which is as follows, port 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 free learning recommendations:JavaScript(video)
The above is the detailed content of How to change the port number in vue.js. For more information, please follow other related articles on the PHP Chinese website!