flow
flow copied to clipboard
Making a Java change causes excessive updates, compile errors and Vite restart
Description of the bug
With an application running with frontend hotdeploy and using Spring Boot dev tools, when you make a Java change you once in a while see this output
2024-03-07T08:35:49.092+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/index.tsx
2024-03-07T08:35:49.093+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/theme-flowex.components.generated.js
2024-03-07T08:35:49.094+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.094+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.097+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.160+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] Pre-transform error: Failed to load url /generated/vite-devmode.ts (resolved id: /Users/artur/test/flowex/frontend/generated/vite-devmode.ts). Does the file exist?
2024-03-07T08:35:49.160+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] Pre-transform error: Failed to load url /generated/vaadin.ts (resolved id: /Users/artur/test/flowex/frontend/generated/vaadin.ts). Does the file exist?
2024-03-07T08:35:49.197+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.198+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.201+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.201+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.201+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.203+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.203+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.203+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.203+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.204+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.204+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.204+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.204+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.204+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.204+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.204+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.204+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.204+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.204+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.205+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.205+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.205+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/theme-flowex.generated.js
2024-03-07T08:35:49.206+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.206+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.206+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/theme-flowex.generated.js
2024-03-07T08:35:49.207+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.207+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-07T08:35:49.522+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2024-03-07T08:35:49.522+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : ERROR(TypeScript) Cannot find module 'Frontend/generated/flow/Flow' or its corresponding type declarations.
2024-03-07T08:35:49.523+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : FILE /Users/artur/test/flowex/frontend/routes.tsx:2:34
2024-03-07T08:35:49.523+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2024-03-07T08:35:49.523+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 1 | import { createBrowserRouter, RouteObject } from 'react-router-dom';
2024-03-07T08:35:49.523+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : > 2 | import { serverSideRoutes } from "Frontend/generated/flow/Flow";
2024-03-07T08:35:49.523+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-07T08:35:49.523+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 3 |
2024-03-07T08:35:49.523+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 4 | export const routes = [
2024-03-07T08:35:49.523+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 5 | ...serverSideRoutes
2024-03-07T08:35:49.523+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2024-03-07T08:35:49.523+02:00 INFO 3385 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [TypeScript] Found 1 error. Watching for file changes.
2024-03-07T08:35:50.435+02:00 INFO 3385 --- [ File Watcher] rtingClassPathChangeChangedEventListener : Restarting due to 1 class path change (0 additions, 0 deletions, 1 modification)
2024-03-07T08:35:50.435+02:00 DEBUG 3385 --- [ File Watcher] rtingClassPathChangeChangedEventListener : Change set: [/Users/artur/test/flowex/target/classes [/Users/artur/test/flowex/target/classes/META-INF/VAADIN/config/flow-build-info.json (MODIFY)]]
Expected behavior
- The same file should not be updated 28 times and each version hot deployed
- When you recompile a Java file, Vite should not need a restart
- There should be no TS errors
Minimal reproducible example
npx @vaadin/cli init --pre flowex
cd flowex
echo vaadin.frontend.hotdeploy=true >> src/main/resources/application.properties
echo logging.level.org.springframework.boot.devtools.autoconfigure.[LocalDevToolsAutoConfiguration$RestartingClassPathChangeChangedEventListener]=DEBUG >> src/main/resources/application.properties
echo logging.level.com.vaadin.base.devserver.DevServerOutputTracker.Reloader=DEBUG >> src/main/resources/application.properties
mvn
When running, in another terminal
touch src/main/java/com/example/application/Application.java && mvn compile
Versions
- Vaadin / Flow version:
- Java version:
- OS version:
- Browser version (if applicable):
- Application Server (if applicable):
- IDE (if applicable):
Seems like many of the errors are related to mvn compile
running mvn vaadin:prepare-frontend
which apparently always writes new versions of all files
Seems like many of the errors are related to
mvn compile
runningmvn vaadin:prepare-frontend
which apparently always writes new versions of all files
The first action that vaadin:prepare-frontend
performs is to delete the contents from the frontend/generated
folder (this produces the [vite] hmr update /generated/flow/Flow.tsx
like messages); then it writes the files again, since they do no exist anymore.
Another cause is that, when maven build executes prepare-frontend, the vaadin-dev-server-settings.json
is overwritten with different contents, triggering another Vite restart.
This is the content generated by the application at first run
{
"frontendFolder": "/path/to/project/flowex/src/main/frontend",
"themeFolder": "themes",
"themeResourceFolder": "/path/to/project/flowex/src/main/frontend/generated/jar-resources",
"staticOutput": "/path/to/project/flowex/target/classes/META-INF/VAADIN/webapp/VAADIN/static",
"generatedFolder": "generated",
"statsOutput": "/path/to/project/flowex/target/classes/META-INF/VAADIN/config",
"frontendBundleOutput": "/path/to/project/flowex/target/classes/META-INF/VAADIN/webapp",
"devBundleOutput": "/path/to/project/flowex/target/dev-bundle/webapp",
"devBundleStatsOutput": "/path/to/project/flowex/target/dev-bundle/config",
"jarResourcesFolder": "/path/to/project/flowex/src/main/frontend/generated/jar-resources",
"themeName": "flowex",
"clientServiceWorkerSource": "/path/to/project/flowex/target/sw.ts",
"pwaEnabled": false,
"offlineEnabled": false,
"offlinePath": "'offline.html'"
}
And this is what prepare-frontend
writes
{
"frontendFolder": "/path/to/project/flowex/src/main/frontend",
"themeFolder": "themes",
"themeResourceFolder": "/path/to/project/flowex/src/main/frontend/generated/jar-resources",
"staticOutput": "target/classes/META-INF/VAADIN/webapp/VAADIN/static",
"generatedFolder": "generated",
"statsOutput": "target/classes/META-INF/VAADIN/webapp/../config/",
"frontendBundleOutput": "target/classes/META-INF/VAADIN/webapp/",
"devBundleOutput": "/path/to/project/flowex/target/dev-bundle/webapp",
"devBundleStatsOutput": "/path/to/project/flowex/target/dev-bundle/config",
"jarResourcesFolder": "/path/to/project/flowex/src/main/frontend/generated/jar-resources",
"themeName": "",
"clientServiceWorkerSource": "/path/to/project/flowex/target/sw.ts",
"pwaEnabled": false,
"offlineEnabled": false,
"offlinePath": "'offline.html'"
}
So , the file written by prepare-frontend
contains some relative paths and it has an empty themeName
.
Another cause of restart is flow-build-info.json
that is always updated, even if there are no changes.
Another case for restart related to flow-build-info.json
: if the application is started from the IDE it will not create a flow-build-info.json
file, so when prepare-frontend
is executed, it will create the file the server gets restarted.
With the changes from the linked PRs, I get a single restart because of class changes
2024-03-22T08:36:09.326+01:00 INFO 20617 --- [ File Watcher] rtingClassPathChangeChangedEventListener : Restarting due to 4 class path changes (0 additions, 0 deletions, 4 modifications)
2024-03-22T08:36:09.326+01:00 DEBUG 20617 --- [ File Watcher] rtingClassPathChangeChangedEventListener : Change set: [/flowex/target/classes [/flowex/target/classes/com/example/application/views/MainLayout.class (MODIFY), /flowex/target/classes/com/example/application/views/helloworld/HelloWorldView.class (MODIFY), /flowex/target/classes/com/example/application/views/about/AboutView.class (MODIFY), /flowex/target/classes/com/example/application/Application.class (MODIFY)]]
However, I can still see Vite compile errors. I suppose this depends on the deletion of all files from frontend/generated
and subsequent re-creation of them.
2024-03-22T08:36:05.955+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/index.tsx, /generated/flow/Flow.tsx
2024-03-22T08:36:05.955+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-22T08:36:05.955+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/theme-flowex.generated.js
2024-03-22T08:36:05.956+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/index.tsx
2024-03-22T08:36:05.956+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/theme-flowex.components.generated.js
2024-03-22T08:36:05.956+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/theme-flowex.generated.js
2024-03-22T08:36:05.957+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-22T08:36:06.203+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2024-03-22T08:36:06.203+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [TypeScript] Found 0 errors. Watching for file changes.
2024-03-22T08:36:07.410+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2024-03-22T08:36:07.411+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [TypeScript] Found 0 errors. Watching for file changes.
2024-03-22T08:36:07.647+01:00 DEBUG 20617 --- [v-server-output] c.v.b.d.DevServerOutputTracker.Reloader : Recompiling because /flowex/src/main/frontend/generated/vaadin.ts changed
2024-03-22T08:36:07.681+01:00 DEBUG 20617 --- [v-server-output] c.v.b.d.DevServerOutputTracker.Reloader : Recompiling because /flowex/src/main/frontend/generated/jar-resources/FlowBootstrap.js changed
2024-03-22T08:36:07.682+01:00 DEBUG 20617 --- [v-server-output] c.v.b.d.DevServerOutputTracker.Reloader : Recompiling because /flowex/src/main/frontend/generated/jar-resources/FlowClient.js changed
2024-03-22T08:36:07.708+01:00 DEBUG 20617 --- [v-server-output] c.v.b.d.DevServerOutputTracker.Reloader : Recompiling because /flowex/src/main/frontend/generated/jar-resources/copilot/copilot-global-vars-later-4huzpYgT.js changed
2024-03-22T08:36:09.306+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2024-03-22T08:36:09.306+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : ERROR(TypeScript) Cannot find module './theme.js' or its corresponding type declarations.
2024-03-22T08:36:09.306+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : FILE /flowex/src/main/frontend/generated/vaadin.ts:34:28
2024-03-22T08:36:09.306+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2024-03-22T08:36:09.306+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 32 |
2024-03-22T08:36:09.306+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 33 | import './theme-flowex.global.generated.js';
2024-03-22T08:36:09.307+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : > 34 | import { applyTheme } from './theme.js';
2024-03-22T08:36:09.307+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : | ^^^^^^^^^^^^
2024-03-22T08:36:09.307+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 35 | applyTheme(document);
2024-03-22T08:36:09.307+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : 36 |
2024-03-22T08:36:09.307+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2024-03-22T08:36:09.307+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [TypeScript] Found 1 error. Watching for file changes.
2024-03-22T08:36:09.326+01:00 INFO 20617 --- [ File Watcher] rtingClassPathChangeChangedEventListener : Restarting due to 4 class path changes (0 additions, 0 deletions, 4 modifications)
2024-03-22T08:36:09.326+01:00 DEBUG 20617 --- [ File Watcher] rtingClassPathChangeChangedEventListener : Change set: [/flowex/target/classes [/flowex/target/classes/com/example/application/views/MainLayout.class (MODIFY), /flowex/target/classes/com/example/application/views/helloworld/HelloWorldView.class (MODIFY), /flowex/target/classes/com/example/application/views/about/AboutView.class (MODIFY), /flowex/target/classes/com/example/application/Application.class (MODIFY)]]
__ _
/ _| | _____ _______ __
| |_| |/ _ \ \ /\ / / _ \ \/ /
| _| | (_) \ V V / __/> <
|_| |_|\___/ \_/\_/ \___/_/\_\
2024-03-22T08:36:09.391+01:00 INFO 20617 --- [ restartedMain] com.example.application.Application : Starting Application using Java 21 with PID 20617 (/flowex/target/classes started by marco in /flowex)
2024-03-22T08:36:09.391+01:00 INFO 20617 --- [ restartedMain] com.example.application.Application : No active profile set, falling back to 1 default profile: "default"
2024-03-22T08:36:09.489+01:00 INFO 20617 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
2024-03-22T08:36:09.490+01:00 INFO 20617 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-03-22T08:36:09.490+01:00 INFO 20617 --- [ restartedMain] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.19]
2024-03-22T08:36:09.498+01:00 INFO 20617 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-03-22T08:36:09.498+01:00 INFO 20617 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 106 ms
2024-03-22T08:36:09.516+01:00 INFO 20617 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing AtmosphereFramework
2024-03-22T08:36:09.839+01:00 INFO 20617 --- [ restartedMain] c.v.f.s.VaadinServletContextInitializer : Search for subclasses and classes with annotations took 301 ms
2024-03-22T08:36:09.844+01:00 INFO 20617 --- [ restartedMain] c.v.b.d.startup.DevModeStartupListener : Starting dev-mode updaters in /flowex folder.
2024-03-22T08:36:09.850+01:00 INFO 20617 --- [ restartedMain] c.v.f.s.f.s.FullDependenciesScanner : Visited 107 classes. Took 5 ms.
2024-03-22T08:36:09.852+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/index.tsx
2024-03-22T08:36:09.853+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-22T08:36:09.853+01:00 DEBUG 20617 --- [v-server-output] c.v.b.d.DevServerOutputTracker.Reloader : Recompiling because /flowex/src/main/frontend/generated/flow/Flow.tsx changed
2024-03-22T08:36:09.853+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/flow/Flow.tsx
2024-03-22T08:36:09.855+01:00 DEBUG 20617 --- [v-server-output] c.v.b.d.DevServerOutputTracker.Reloader : Recompiling because /flowex/src/main/frontend/generated/flow/ReactAdapter.tsx changed
2024-03-22T08:36:09.862+01:00 INFO 20617 --- [onPool-worker-5] c.v.f.s.frontend.TaskUpdatePackages : Skipping `npm install` because the frontend packages are already installed in the folder '/flowex/node_modules' and the hash in the file '/flowex/node_modules/.vaadin/vaadin.json' is the same as in 'package.json'
2024-03-22T08:36:09.862+01:00 INFO 20617 --- [onPool-worker-5] c.v.f.s.frontend.TaskCopyFrontendFiles : Copying frontend resources from jar files ...
2024-03-22T08:36:09.892+01:00 INFO 20617 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2024-03-22T08:36:09.895+01:00 INFO 20617 --- [onPool-worker-5] c.v.f.s.frontend.TaskCopyFrontendFiles : Visited 21 resources. Took 32 ms.
2024-03-22T08:36:09.980+01:00 INFO 20617 --- [onPool-worker-5] c.v.b.devserver.AbstractDevServerRunner : Reusing Vite running at http://127.0.0.1:33327
2024-03-22T08:36:09.985+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] Pre-transform error: Failed to resolve import "./theme-flowex.global.generated.js" from "src/main/frontend/generated/vaadin.ts". Does the file exist?
2024-03-22T08:36:09.997+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] Pre-transform error: Failed to resolve import "./theme-flowex.generated.js" from "src/main/frontend/generated/theme.js". Does the file exist?
2024-03-22T08:36:10.004+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/theme-flowex.components.generated.js
2024-03-22T08:36:10.004+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [vite] hmr update /generated/theme-flowex.generated.js
2024-03-22T08:36:10.977+01:00 INFO 20617 --- [ restartedMain] c.vaadin.flow.spring.SpringInstantiator : The number of beans implementing 'I18NProvider' is 0. Cannot use Spring beans for I18N, falling back to the default behavior
2024-03-22T08:36:10.982+01:00 WARN 20617 --- [ restartedMain] c.v.h.s.RouteUnifyingServiceInitListener : Failed to find views.json
2024-03-22T08:36:10.982+01:00 INFO 20617 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path ''
2024-03-22T08:36:10.984+01:00 INFO 20617 --- [ restartedMain] com.example.application.Application : Started Application in 1.605 seconds (process running for 264.462)
2024-03-22T08:36:10.985+01:00 INFO 20617 --- [ restartedMain] .ConditionEvaluationDeltaLoggingListener : Condition evaluation unchanged
2024-03-22T08:36:11.722+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker :
2024-03-22T08:36:11.722+01:00 INFO 20617 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [TypeScript] Found 0 errors. Watching for file changes.
After the restart, the application seems to work correctly.
I don't know if there is something we can do to somehow "pause" Vite while during prepare-frontend
and trigger a recompilation after the tasks is completed.
Do we need to delete frontend/generated in prepare-frontend? clean-fronted yes, but does it matter for the other parts?
Delete was introduced by #16647 to fix #16640. It seems to me it could be still relevant
Right they might reference and get pulled in... Perhaps we could be smarter about it and clean in the copy phase so we update and then remove files not in the to copy list...
Just FYI: this also happens when building with gradle. We currently only work with prod mode builds due to this.
Is this still an issue @mcollovati or can we close?
Most of the restart causes should have been fixed. I plan to retest today.
Tested against beta2 and I can see a single restart after compiling changes.
I also tried it with the Gradle starter project, by having one terminal running ./gradlew bootJar
and in the other executing ./gradlew compileJava
after modifying a Java source file.
Unfortunately, with Gradle, I was unable to reproduce the issue with previous Vaadin versions and the above commands.
Based on the testing results, I believe we can close this issue.