antfu / vite-plugin-restart

Custom files/globs to restart Vite server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vite restart in new port,not kill init port

taajason opened this issue · comments

vite.config.js add watcher .env.local
plugin: [
ViteRestart({
restart: ["vite.config.js", ".env.local"]
})
]
server: {
port: 8080
}

start project with vite,then success in port 8080

Pre-bundling dependencies: 10:48:02
vue
vuex
lodash
(this will be run only when your dependencies or config have changed) 10:48:02
10:48:03
vite v2.7.12 dev server running at:

Local: http://localhost:8080/ 10:48:03
Network: http://192.168.41.178:8080/ 10:48:03
Network: http://192.168.4.144:8080/ 10:48:03
10:48:03
ready in 2531ms.

When I change the file .env.local,vite restart in port 8081 and 8082 but NOT 8080

10:48:30 AM [plugin-restart] restarting server by .env.local 10:48:30
10:48:30 AM [vite] vite.config.js changed, restarting server... 10:48:30
Pre-bundling dependencies: 10:48:30
vue
vuex
lodash
(...and 25 more)
(this will be run only when your dependencies or config have changed) 10:48:30
10:48:31 AM [plugin-restart] restarting server by vite.config.js 10:48:31
10:48:31 AM [vite] vite.config.js changed, restarting server... 10:48:31
Pre-bundling dependencies: 10:48:31
vue
vuex
lodash
(...and 25 more)
(this will be run only when your dependencies or config have changed) 10:48:31
10:48:31 AM [plugin-restart] restarting server by vite.config.js 10:48:31
10:48:32 AM [vite] vite.config.js changed, restarting server... 10:48:32
Pre-bundling dependencies: 10:48:32
vue
vuex
lodash
(...and 25 more)
(this will be run only when your dependencies or config have changed) 10:48:32
10:48:32 AM [vite] server restarted. 10:48:32
10:48:32 AM [plugin-restart] restarting server by vite.config.js 10:48:32
10:48:32 AM [vite] vite.config.js changed, restarting server... 10:48:32
10:48:33 AM [plugin-restart] restarting server by vite.config.js 10:48:33
Pre-bundling dependencies: 10:48:33
vue
vuex
lodash
(...and 25 more)
(this will be run only when your dependencies or config have changed) 10:48:33
Port 8080 is in use, trying another one... 10:48:34
10:48:34 AM [vite] server restarted. 10:48:34
Port 8080 is in use, trying another one... 10:48:35
Port 8081 is in use, trying another one... 10:48:35
10:48:35 AM [vite] server restarted. 10:48:35
Port 8080 is in use, trying another one... 10:48:35
Port 8081 is in use, trying another one... 10:48:35
Port 8082 is in use, trying another one... 10:48:35
10:48:35 AM [vite] server restarted. 10:48:35

commented

yes