Comments (14)
Just FYI: this also happens when building with gradle. We currently only work with prod mode builds due to this.
from flow.
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
from flow.
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.
from flow.
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
.
from flow.
Another cause of restart is flow-build-info.json
that is always updated, even if there are no changes.
from flow.
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.
from flow.
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.
from flow.
Do we need to delete frontend/generated in prepare-frontend?
clean-fronted yes, but does it matter for the other parts?
from flow.
Delete was introduced by #16647 to fix #16640.
It seems to me it could be still relevant
from flow.
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...
from flow.
Is this still an issue @mcollovati or can we close?
from flow.
Most of the restart causes should have been fixed. I plan to retest today.
from flow.
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.
from flow.
Based on the testing results, I believe we can close this issue.
from flow.
Related Issues (20)
- Provide an API to find a Java class for component with a given tag
- ComboBoxLazyDataView does not honour setIdentifierProvider() properly -- items show twice without overridden equals/hashCode HOT 1
- Nullpointer exception in flow server HOT 12
- V14 failing on frontend compilation during npm install on Tomcat 9
- MAU tracking for unified platform 24.4
- TreeGrid documentation for getDataProvider() points to Grid.getListDataView() and Grid.getLazyDataView() for more "information and control over the items in the grid" while these are unsupported.
- HierarchicalDataProvider.refreshItem(null) throws NullPointerException, see video HOT 5
- TreeGrid.getTreeData().setParent() may duplicate data item in the TreeGrid, and forgets moving children. See video. HOT 1
- Support content elements in React adapter
- lastHandledNavigation not cleared on page reload with @PreserveOnRefresh
- navigation issue with hybrid application HOT 8
- types.d.ts comparison fails due to white space difference
- treeGrid.getTreeData().setParent() may lose parent and children. See video. HOT 2
- Blocked thread on ViteWebsocketConnection creation
- Provide a getDefaultLocale in I18NProvider
- Provide a way to customize the translations for Hilla HOT 8
- GraalVM native image and VaadinSecurityFilterChainBean HOT 11
- Web Components are replaced with React Components in a flow only application HOT 6
- Flow prints unsupported feature flag warning message for non-feature related system properties
- Navigation Trigger is always CLIENT_SIDE HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flow.