vercel+vue生成免域名静态网站

  • Post author:
  • Post category:vue

本地启动自己代码服务,看自己代码样式

参考视频 部署 https://www.bilibili.com/video/BV1UA411F7Mr

参考视频 如何在全球范围提升网站访问速度 https://www.bilibili.com/video/BV1xy4y1s73g

参考文章 https://www.bbsmax.com/A/QV5Zon3Zdy/

F:\vuetest\vue-manager-app>npm run dev
INFO Starting development server…

DONE Compiled successfully in 4053ms
App running at:

  • Local: http://localhost:8080
  • Network: http://192.168.1.8:8080
    Note that the development build is not optimized.
    To create a production build, run npm run build.
    ctrl+c
    终止批处理操作吗(Y/N)?Y

全局安装vercel

F:\vuetest\vue-manager-app>npm i -g vercel

added 150 packages in 13s

在项目下新建vercel.json

{
“version”: 2,
“builds”: [
{
“src”: “index.js”,
“use”: “@vercel/node”
}
]
}

登录->我这里使用 github 认证

F:\vuetest\vue-manager-app> vercel login
Vercel CLI 28.12.4

Log in to Vercel github
Please visit the following URL in your web browser:
Success! GitHub authentication complete for *****@qq.com
Congratulations! You are now logged in. In order to deploy something, run vercel.
💡 Connect your Git Repositories to deploy every branch push automatically (https://vercel.link/git).

这里不是dist文件 下面为 n vercel意思是上传文件到服务其中

F:\vuetest\vue-manager-app> vercel
Vercel CLI 28.12.4
? Set up and deploy “F:\vuetest\vue-manager-app”? [Y/n] n
Canceled. Project not set up.

进入dist静态文件

F:\vuetest\vue-manager-app>cd dist

根据情况选择下面选项

F:\vuetest\vue-manager-app\dist> vercel
Vercel CLI 28.12.4
? Set up and deploy “F:\vuetest\vue-manager-app\dist”? [Y/n] y
? Which scope do you want to deploy to? super-crayfish
? Link to existing project? [y/N] n
? What’s your project’s name? meiduo —> 这里启用美多(meiduo)商城名称
? In which directory is your code located? ./
Local settings detected in vercel.json:
No framework detected. Default Project Settings:

  • Build Command: npm run vercel-build or npm run build
  • Development Command: None
  • Install Command: yarn install, pnpm install, or npm install
  • Output Directory: public if it exists, or .
    ? Want to modify these settings? [y/N] n
    🔗 Linked to super-crayfish/meiduo (created .vercel and added it to .gitignore)
    🔍 Inspect: https://vercel.com/****/meiduo/FxaqXTRkC3SMKVa9wPJJB3sh9twP [1s]

生成访问连接 访问试试

✅ Production: https://meiduo-five.vercel.app [8s]

📝 Deployed to production. Run vercel --prod to overwrite later (https://vercel.link/2F).
💡 To change the domain or build command, go to https://vercel.com/super-crayfish/meiduo/settings

请添加图片描述


版权声明:本文为qq_41638872原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。