This behavior causes a problem to me because in my vite plugin I create a websocket server to listen to some external changes, so the double loading behavior causing the WebSocketServer to be initialized twice during the build process which leads the build to fail.
I've already reported a smiliar issue here #22158, but it was due to a misuse on my side.
Current Behavior
When a target is defined in project.json using @nx/vite:build
And a custom vite plugin is defined like this
Running this target will execute my custom plugin config's hook twice
This problem popped after I migrated from Nx 19 to Nx 20
Expected Behavior
The vite plugin config's hook should be called only once.
GitHub Repo
https://github.com/abarghoud/nx-vite-config-called-twice-bug
Steps to Reproduce
Nx Report
Failure Logs
Package Manager Version
1.22.22
Operating System
Additional Information
This behavior causes a problem to me because in my vite plugin I create a websocket server to listen to some external changes, so the double loading behavior causing the WebSocketServer to be initialized twice during the build process which leads the build to fail.
I've already reported a smiliar issue here #22158, but it was due to a misuse on my side.