Debugging Vite packaged code locally

Problem background

A page developed using Vue3 + Vant + Vite. After the local style as follows
Insert image description here
cannot be sent to the test environment, the style of the Search component is obviously different from the local runtime, so I want to run the packaged code locally to see where the problem lies. where

I ran the packaged code locally and found that the style loading order was inconsistent.
Insert image description here

Steps to debug Vite packaged code locally

// 1、安装服务器环境
npm install -g serve
// 2、打包本地项目
npm run build
// 3、启动
serve -s dist

After startup, access http://localhost:3000 which is the index.html content in the dist file.
Insert image description here

Guess you like

Origin blog.csdn.net/xiaoxiannv666/article/details/127980384