magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.58k stars 9.32k forks source link

Static deploy doesn't update files #38176

Open webloft opened 1 year ago

webloft commented 1 year ago

Summary

There are files which gets never updated by command set:sta:dep - and it's very annoying if you need to this in production mode as it costs real- and downtime for clients. The only work around is to entire removing pub/static/frontend and/or var/view_preprocessed.

I don't know it this is reported yet, I really wonder if not. We are still expierencing this behaviour in 2.4.6

Examples

It affects multiple files if changes are made in theme files/overrides:

Running set:sta:dep -f will update nothing here for pub/static/frontend and switching strategy has also no effect on this.

Additional Information

Your basic vanilla theme may does not trigger the bugs. Therefore it's needed to test it on a real world example. We work with different clients that uses different themes and expierence the same problems. One client even uses a custom theme that is only styles and templates, no custom code or interceptors that could cause troubles.

As written before - the most common one is if a CSS file from a theme is modified by the client. This can be a normal file included via Magento_Theme/layout/default_head_blocks.xml like this:

<css src="Magento_Theme::css/custom.css"/>

and placed in /app/design/frontend/theme/child/Magento_Theme/web/css/custom.css

We verified that the file was modified on the server.

We run the command set:sta:dep -f in production mode. It displays the process and everything seems fine.

However, if we inspect the file in pub/static/frontend/theme/child/en_US/Magento_Theme/css the file is there, minified as custom.min.css but contents are not updated and the file is not touched at all.

Only if we remove the complete folder or at least the affected area/theme, the changes will be applied.

Observation:

It works if the file is not there. But for some reasons the file will be ignored if it's already there.

Also applies to dynamic JS translation file, for example: en_US/js-translation.json.

We updated a theme translation file. It was ignored by deploy command. The changes will be applied if we remove en_US/js-translation.json manually and then run static deploy command again.

Proposed solution

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 year ago

Hi @webloft. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 1 year ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Hotel commented 1 year ago

Hello @webloft,

Thanks for the report and collaboration!

We have tried to reproduce the issue in the vanilla 2.4-develop branch. But the issue is not reproducible for us. We have followed the below DevDocs:

https://experienceleague.adobe.com/docs/commerce-operations/configuration-guide/cli/static-view/static-view-file-deployment.html

Can you please let us know which kind of changes is not reflecting for you after running bin/magento setup:static-content:deploy command?

Thanks

webloft commented 1 year ago

Your basic vanilla theme may does not trigger the bugs. Therefore it's needed to test it on a real world example. We work with different clients that uses different themes and expierence the same problems. One client even uses a custom theme that is only styles and templates, no custom code or interceptors that could cause troubles.

As written before - the most common one is if a CSS file from a theme is modified by the client. This can be a normal file included via Magento_Theme/layout/default_head_blocks.xml like this:

<css src="Magento_Theme::css/custom.css"/>

and placed in /app/design/frontend/theme/child/Magento_Theme/web/css/custom.css

We verified that the file was modified on the server.

We run the command set:sta:dep -f in production mode. It displays the process and everything seems fine.

However, if we inspect the file in pub/static/frontend/theme/child/en_US/Magento_Theme/css the file is there, minified as custom.min.css but contents are not updated and the file is not touched at all.

Only if we remove the complete folder or at least the affected area/theme, the changes will be applied.

Observation:

It works if the file is not there. But for some reasons the file will be ignored if it's already there.

Also applies to dynamic JS translation file, for example: en_US/js-translation.json.

We updated a theme translation file. It was ignored by deploy command. The changes will be applied if we remove en_US/js-translation.json manually and then run static deploy command again.

engcom-Hotel commented 1 year ago

Hello @webloft,

Thanks for the detailed description!

It helps us with the issue reproduction. The issue can be reproducible using a custom theme. After changing in the custom.css file we need to delete either the entire folder from the pub/static theme folder or the affected file only then the changes be reflected on the frontend.

Hence confirming the issue.

Thanks

github-jira-sync-bot commented 1 year ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-10573 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 year ago

:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.