vue.js更改端口号的方法:1、config文件夹中有一个【index.js】其中部分内容如下,port即为端口号,在这里更改;2、【Vue 3.x】中修改端口号则需要在项目根目录下创建一个【vue.config.js】。

本教程操作环境:windows10系统、vue2.9,本文适用于所有品牌的电脑。
【相关文章推荐:vue.js】
vue.js更改端口号的方法:
1.Vue 2.x
立即学习“前端免费学习笔记(深入)”;
config文件夹中有一个index.js其中部分内容如下,port即为端口号,在这里更改即可。
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
Vue 3.x中修改端口号则需要在项目根目录下创建一个vue.config.js,内容如下。
module.exports = {
devServer: {
port: 8080, // 端口号
}
};相关免费学习推荐:JavaScript(视频)
以上就是vue.js怎么改端口号的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号