flow: Vite doesn't detect changes in files in target/flow-frontend
Description of the bug
We have a maven multimodule project where js/ts files from different maven modules end up in target/flow-frontend directory. Once the server is started for the first time (in development mode), vite creates the node_modules/.vite folder and it works. However any time I make a change in other modules and the updated file gets to target/flow-frontend, vite doesn’t detect the change until I manually delete the node_modules/.vite directory and restart the server.
We even have a custom file watcher implemented which copies the modified files from src/main/resources/META-INF/resources/frontend from other modules to target/flow-frontend even when the server is running - this caused webpack to reload the page and the changes were effective even without server restart. However this doesn’t work with vite, not even with server restart.
Versions:
- Vaadin / Flow version: 23.2.2
- Java version: 17
- OS version: Mac OS 12.6
- Browser version (if applicable): Chrome 105.0.5195.125
- Application Server (if applicable): Spring boot 2.7.3 with embedded tomcat
- IDE (if applicable): Intellij IDEA
- Development or production mode: development
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 5
- Comments: 20 (8 by maintainers)
Commits related to this issue
- fix: Watch flow-frontend for changes Especially in multi module projects, the folder is updated with new contents quite often. Also if you change an addon version, the changes need to be picked up. ... — committed to vaadin/flow by Artur- 2 years ago
- fix: Watch flow-frontend for changes Especially in multi module projects, the folder is updated with new contents quite often. Also if you change an addon version, the changes need to be picked up. ... — committed to vaadin/flow by Artur- 2 years ago
- fix!: Extract addon files to frontend/generated/jarResources instead of a fake npm package No longer creates target/flow-frontend so any tool or script relying on that needs to be updated Fixes #146... — committed to vaadin/flow by Artur- 2 years ago
- fix!: Extract addon files to frontend/generated/jarResources instead of a fake npm package No longer creates target/flow-frontend so any tool or script relying on that needs to be updated Fixes #146... — committed to vaadin/flow by Artur- 2 years ago
- fix!: Extract addon files to frontend/generated/jarResources instead of a fake npm package No longer creates target/flow-frontend so any tool or script relying on that needs to be updated Fixes #146... — committed to vaadin/flow by Artur- 2 years ago
- fix!: Extract addon files to frontend/generated/jar-resources instead of a fake npm package (#14979) No longer creates target/flow-frontend so any tool or script relying on that needs to be updated ... — committed to vaadin/flow by Artur- 2 years ago
- fix!: Extract addon files to frontend/generated/jar-resources instead of a fake npm package (#14979) (#15001) No longer creates target/flow-frontend so any tool or script relying on that needs to be ... — committed to vaadin/flow by vaadin-bot 2 years ago
- chore: Make @vaadin/flow-frontend jar-resources change backwards compatible Related to #14695 — committed to vaadin/flow by Artur- 2 years ago
- chore: Make @vaadin/flow-frontend jar-resources change backwards compatible Related to #14695 — committed to vaadin/flow by Artur- 2 years ago
- chore: Make @vaadin/flow-frontend jar-resources change backwards compatible (#15056) Related to #14695 — committed to vaadin/flow by Artur- 2 years ago
- chore: Make @vaadin/flow-frontend jar-resources change backwards compatible (#15056) Related to #14695 — committed to vaadin/flow by Artur- 2 years ago
- chore: Make @vaadin/flow-frontend jar-resources change backwards compatible (#15056) (#15070) Related to #14695 Co-authored-by: Artur <artur@vaadin.com> — committed to vaadin/flow by vaadin-bot 2 years ago
any updates ?
I don’t see any button to attach the file here, so I tried to share it on goodle drive: https://drive.google.com/file/d/1P-1umxNEKjkMxp2iBP0IFJbWOTr6R-jt/view?usp=sharing
The file is experimental, not a clean code, but it works… Feel free to modify it for your needs. It will try to find all
META-INF/resources/frontend,META-INF/frontendandMETA-INF/resources/themesfolders in anytargetfolder of your modules on classpath and copies them totarget/flow-frontendfolder in your bootstrap module whenever it detects a change with slight delay to avoid duplicate activations. Also you need to press compile button in Intellij Idea if you modify your js/ts/css files in mentioned folders so they get copied to target (it doesn’t watch the src folder). It doesn’t do anything by itself, you need to register it as listener when starting your spring boot application:If you set this in your vite.config.ts it should work