1. Docker port mapping failed
$NPM run dev = $NPM run dev = $NPM Finally, check the document to configure the host parameter for Vite, port mapping is successful.
// vite.config.ts
// https://cn.vitejs.dev/config/#server-host
export default defineConfig({
plugins: [vue()],
server: {
host: '0.0.0.0',}})Copy the code
2. Frequent refresh of the local browser
The frequent refresh of the local browser loses the advantages of Vite development, which makes it impossible to use Docker as a Vite development environment. See the following image:
There is a solution, welcome to inform.