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

Application Shell Template does not work: index.html does not get used in production #20629

Closed
leangermany opened this issue Dec 5, 2024 · 4 comments · Fixed by #20729
Closed

Comments

@leangermany
Copy link

Description of the bug

The index.html file does not get used in production mode. I added a <script> to the head and in dev mode it works fine. When using mvn package -Pproduction the index.html does not contain any of my changes. In fact the default template is used.

Expected behavior

The /frontend/index.html is used in production mode.

Minimal reproducible example

  1. Download a new default starter with an empty Flow page from start.vaadin.com
  2. Change the index.html, remove all comments & add script
  3. Execute mvn package -Pproduction
  4. Execute the jar
  5. Incpect the website in browser. No script is there and all comments are back (like <!-- This outlet div is where the views are rendered -->)

Versions

  • Vaadin / Flow version: 24.5.7
  • Java version: 17 & 21
  • OS version: Win 10
  • Browser version (if applicable): Chrome, Firefox
  • Application Server (if applicable): starter default
  • IDE (if applicable): VS Code
@Artur-
Copy link
Member

Artur- commented Dec 6, 2024

I wonder if this is a problem that the production bundle is not being built at all but the default one is used. Then you should see

[INFO] Checking if a production mode bundle build is needed
[INFO] A production mode bundle build is not needed

in the build log

@Artur-
Copy link
Member

Artur- commented Dec 6, 2024

If so, adding -Dvaadin.force.production.build=true should make it work

@leangermany leangermany changed the title Application Shell Template does not work: index.html does not get used production Application Shell Template does not work: index.html does not get used in production Dec 6, 2024
@leangermany
Copy link
Author

[INFO] Checking if a production mode bundle build is needed
[INFO] A production mode bundle build is not needed

This is the case.

@leangermany
Copy link
Author

If so, adding -Dvaadin.force.production.build=true should make it work

That did work! I added this to my pom:

<configuration>
       <forceProductionBuild>true</forceProductionBuild>
</configuration>

@mshabarov mshabarov moved this to 🔖 Normal Priority (P2) in Vaadin Flow bugs & maintenance (Vaadin 10+) Dec 9, 2024
@mshabarov mshabarov moved this to 🪵Product backlog in Vaadin Flow ongoing work (Vaadin 10+) Dec 9, 2024
@tepi tepi self-assigned this Dec 9, 2024
@tepi tepi moved this from 🪵Product backlog to ⚒️ In progress in Vaadin Flow ongoing work (Vaadin 10+) Dec 9, 2024
@mshabarov mshabarov moved this from 🔖 Normal Priority (P2) to 🏗 WIP in Vaadin Flow bugs & maintenance (Vaadin 10+) Dec 10, 2024
@mcollovati mcollovati assigned mcollovati and unassigned tepi Dec 16, 2024
mcollovati added a commit that referenced this issue Dec 16, 2024
Stores index.html hash in stats.json and forces production bundle
to be re-built if file contents has changed.
Changes to index.html does not trigger a dev bundle re-generation
since in dev mode the file is served directly from the frontend
folder.

Fixes #20629
mcollovati added a commit that referenced this issue Dec 16, 2024
Stores index.html hash in stats.json and forces production bundle to be
re-built if file contents have changed. Changes to index.html do not
trigger a dev bundle re-generation since in dev mode the file is served
directly from the frontend folder.

Fixes #20629
@mcollovati mcollovati moved this from ⚒️ In progress to 🔎Iteration reviews in Vaadin Flow ongoing work (Vaadin 10+) Dec 16, 2024
@github-project-automation github-project-automation bot moved this from 🔎Iteration reviews to Done in Vaadin Flow ongoing work (Vaadin 10+) Dec 18, 2024
vaadin-bot pushed a commit that referenced this issue Dec 18, 2024
Stores index.html hash in stats.json and forces production bundle to be
re-built if file contents have changed. Changes to index.html do not
trigger a dev bundle re-generation since in dev mode the file is served
directly from the frontend folder.

Fixes #20629
vaadin-bot pushed a commit that referenced this issue Dec 18, 2024
Stores index.html hash in stats.json and forces production bundle to be
re-built if file contents have changed. Changes to index.html do not
trigger a dev bundle re-generation since in dev mode the file is served
directly from the frontend folder.

Fixes #20629
vaadin-bot pushed a commit that referenced this issue Dec 18, 2024
Stores index.html hash in stats.json and forces production bundle to be
re-built if file contents have changed. Changes to index.html do not
trigger a dev bundle re-generation since in dev mode the file is served
directly from the frontend folder.

Fixes #20629
vaadin-bot added a commit that referenced this issue Dec 18, 2024
Stores index.html hash in stats.json and forces production bundle to be
re-built if file contents have changed. Changes to index.html do not
trigger a dev bundle re-generation since in dev mode the file is served
directly from the frontend folder.

Fixes #20629

Co-authored-by: Marco Collovati <[email protected]>
vaadin-bot added a commit that referenced this issue Dec 18, 2024
Stores index.html hash in stats.json and forces production bundle to be
re-built if file contents have changed. Changes to index.html do not
trigger a dev bundle re-generation since in dev mode the file is served
directly from the frontend folder.

Fixes #20629

Co-authored-by: Marco Collovati <[email protected]>
vaadin-bot added a commit that referenced this issue Dec 18, 2024
Stores index.html hash in stats.json and forces production bundle to be
re-built if file contents have changed. Changes to index.html do not
trigger a dev bundle re-generation since in dev mode the file is served
directly from the frontend folder.

Fixes #20629

Co-authored-by: Marco Collovati <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

5 participants