Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: Remove fallback chunk #16592

Merged
merged 1 commit into from Apr 17, 2023
Merged

chore!: Remove fallback chunk #16592

merged 1 commit into from Apr 17, 2023

Conversation

Artur-
Copy link
Member

@Artur- Artur- commented Apr 16, 2023

The fallback chunk contained all JavaScript and CSS for classes which cannot be reached from an entry point (route or exported web component). By removing it we improve performance as we do not need to scan all classes, only the reachable ones. We also fix issues with the license checker as it did not really know how to behave with commercial components that may or may not be used.

The drawback of removing the fallback chunk is that if you are using a component which is not reachable, as determined by the scanner, then your JS/CSS for the component will be missing. The typical case for this is having a factory that can create components using reflection. The scanner is not able to find the referenced classes as they only appear as a string in the source code. For this case, you need to add @Uses(SomeComponent.class) to the factory, for each component it can create using reflection.

To be able to detect unreachable components in development mode, you should set the devmode.optimizeBundle property to true.

Fixes #15929

@github-actions
Copy link

github-actions bot commented Apr 16, 2023

Test Results

   980 files   -   2     980 suites   - 2   1h 14m 3s ⏱️ - 4m 31s
6 166 tests  - 10  6 128 ✔️  - 10  38 💤 ±0  0 ±0 
6 417 runs   - 12  6 372 ✔️  - 12  45 💤 ±0  0 ±0 

Results for commit 5a8a609. ± Comparison against base commit 3dae5ba.

This pull request removes 10 tests.
com.vaadin.flow.server.DeploymentConfigurationFactoryTest ‑ createInitParameters_fallbackChunkIsCreatedViaAppConfig_fallbackChunkObjectIsInInitParams
com.vaadin.flow.server.DeploymentConfigurationFactoryTest ‑ createInitParameters_servletConfigDefinesTokenFile_fallbackChunkObjectIsInInitParams
com.vaadin.flow.server.frontend.NodeUpdateImportsTest ‑ emptyByteCodeScannerData_themeIsDiscovered_fallbackIsGenerated
com.vaadin.flow.server.frontend.NodeUpdateImportsTest ‑ extraComponentsInCP_componentsAreNotDiscoveredByMainScannerWrittenByFallback_fallbackIsGenerated
com.vaadin.flow.server.frontend.NodeUpdateImportsTest ‑ noFallBackScanner_fallbackIsNotGenerated
com.vaadin.flow.server.frontend.NodeUpdateImportsTest ‑ noFallBackScanner_fallbackIsNotImportedEvenIfTheFileExists
com.vaadin.flow.server.frontend.NodeUpdateImportsTest ‑ tokenFileIsStable
com.vaadin.flow.spring.service.SpringServletTest ‑ fallbackChunk_givenInInitParameter_passedOnToDeploymentConfiguration
com.vaadin.flow.testnpmonlyfeatures.bytecodescanning.FallbackByteCodeScanningIT(prodfallback) ‑ buttonIsInitializedInProductionMode[ANY_Chrome_]
com.vaadin.viteapp.TemplateIT ‑ testElementReferencedByReflection[ANY_Chrome_]

♻️ This comment has been updated with latest results.

@Artur- Artur- force-pushed the remove-fallback branch 3 times, most recently from 0141267 to a5d7686 Compare April 17, 2023 05:04
@Artur- Artur- marked this pull request as ready for review April 17, 2023 07:27
@Artur- Artur- requested a review from caalador April 17, 2023 10:56
The fallback chunk contained all JavaScript and CSS for classes which cannot be reached from an entry point (route or exported web component).
By removing it we improve performance as we do not need to scan all classes, only the reachable ones. We also fix issues with the license checker as it did not really know how to behave with commercial components that may or may not be used.

The drawback of removing the fallback chunk is that if you are using a component which is not reachable, as determined by the scanner, then your JS/CSS for the component will be missing. The typical case for this is having a factory that can create components using reflection. The scanner is not able to find the referenced classes as they only appear as a string in the source code. For this case, you need to add `@Uses(SomeComponent.class)` to the factory, for each component it can create using reflection.

To be able to detect unreachable components in development mode, you should set the `devmode.optimizeBundle` property to `true`.

Fixes #15929
@sonarcloud
Copy link

sonarcloud bot commented Apr 17, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Artur- Artur- enabled auto-merge (squash) April 17, 2023 12:09
@Artur- Artur- merged commit 3aaaeea into main Apr 17, 2023
27 checks passed
@Artur- Artur- deleted the remove-fallback branch April 17, 2023 12:19
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove the fallback bundle logic
3 participants