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

Js error on Symfony Prod mode because of moved inline JS #538

Open
Gugiman opened this issue Aug 28, 2024 · 0 comments
Open

Js error on Symfony Prod mode because of moved inline JS #538

Gugiman opened this issue Aug 28, 2024 · 0 comments

Comments

@Gugiman
Copy link

Gugiman commented Aug 28, 2024

Describe the bug
If you change from dev to Production mode in .env, the inline JS moved to the head of the DOM.
This symfony default behaviour:
https://symfony.com/blog/moving-script-inside-head-and-the-defer-attribute#the-caveat-inline-javascript-cannot-be-deferred

Therefore no customer can checkout correctly.

Versions
Shopware version: 6.5.8.13
Plugin version: 3.15.0

To Reproduce
Steps to reproduce the behavior:

  1. Setup a running Adyen implementation with Paypal and credit card in Shopware dev mode
  2. Verify that the Credit Card Field are loaded on checkout/confirm
  3. Switch from dev to prod in .env and clear all caches
  4. Reload Page and see a js console error because
    document.querySelector('#adyen-checkout-options').dataset is called and executed in the head before the <div id="adyen-checkout-options"> exists.

Expected behavior
Inline JS should be called after the DOM is completely rendered by the Browser or the <script> tags have to have the attribute "defer"

Desktop (please complete the following information):

  • OS: Kubuntu 22.04
  • Browser Chromium
  • Version 127.0.6533.72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant