Gutenberg does not load with css and js aggregation enabled

Created on 20 March 2023, over 1 year ago
Updated 27 July 2023, over 1 year ago

Problem/Motivation

Gutenberg does not load after updating to Drupal 9.5.5 and Gutenberg 2.7 if css and js aggregation is enabled in /admin/config/development/performance

Steps to reproduce

Update to Drupal 9.5.5
Update to Gutenberg 2.7
Enable Aggregate CSS files
Enable Aggregate JavaScript files

🐛 Bug report
Status

Closed: works as designed

Version

2.7

Component

Code

Created by

🇫🇮Finland iamfredrik

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @iamfredrik
  • Status changed to Postponed: needs info over 1 year ago
  • 🇩🇪Germany szeidler Berlin
    1. Does a clear cache helps to resolve the problem?
    2. Does disabling the aggregation helps?
    3. Are you able to reproduce the problem on a clean Drupal with Gutenberg installation

    I'm asking because we have a couple of sites in production using the combination of versions and aggregated JS+CSS, where Gutenberg just loads normally.

    Could it be related to https://www.drupal.org/project/gutenberg/issues/3343392 🐛 Gutenberg is not loading properly Active + the releated Core task?

  • 🇫🇮Finland iamfredrik

    1. No, clearing cache did not help.
    2. Yes, the issue exists only with aggregation enabled as mentioned in the problem description.
    3. Have not tried. We have this module installed on a few sites, but have since moved away from using it because of too many issues.

  • 🇩🇪Germany szeidler Berlin

    It would be cool, if you could verify it on a clean installation, either locally or via https://simplytest.me just to exclude that it's related to other modules, e.g. advagg, the admin theme, the site being big with a lot of assets.

  • 🇫🇮Finland iamfredrik

    Don't have time to test right now. I trust that it works if you say it works. The site in question is very basic and uses the Claro admin theme and no advagg. Enclosed is a screenshot of the console errors when Gutenberg whitescreens. What idea what could cause these issues?

  • It appears to be a similar issue Gutenberg had in Summer 2021. Back then I also had to disable "JavaScript aggregation" in Drupal, to make Gutenberg work again.

    Clearing or rebuilding the cache doesn't work.

    This applies at least to Gutenberg 2.6 and 2.7 on Drupal 9.5.7 and Drupal 10.0.7.

    When editing an existing Gutenberg Node only a blank page appears. This JS Console logs the following. Please note the mention of "ckeditor5", even though Gutenberg is set as the editor experience.

    js_oGVhFoJSzYmtKkAU7Q-DvVAeEi5XdTX41XcP8FjpYEw.js:460 Uncaught TypeError: Cannot read properties of undefined (reading 'add')
    js__w5pLCa3H6-yaNBVSNbzc1mcHIWGDE9q8drcLrXBs_Y.js:1234 Uncaught TypeError: Cannot set properties of undefined (setting 'ckeditor5')
    js_l-SJjzITCgj_LX-yX-nDLa_jcGp2EZdI08I-q23-2RE.js:327 Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
    js_OTutR6s4jXjIY3MM7LUGlFPpcXceQ2PjFSoC5TdTcyg.js:7635 Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
    js_oGVhFoJSzYmtKkAU7Q-DvVAeEi5XdTX41XcP8FjpYEw.js:208 Uncaught TypeError: $autocomplete.autocomplete is not a function
        at Object.attach (js__w5pLCa3H6-yaNBVSNbzc1mcHIWGDE9q8drcLrXBs_Y.js:975:23)
        at js_oGVhFoJSzYmtKkAU7Q-DvVAeEi5XdTX41XcP8FjpYEw.js:218:24
        at Array.forEach (<anonymous>)
        at Drupal.attachBehaviors (js_oGVhFoJSzYmtKkAU7Q-DvVAeEi5XdTX41XcP8FjpYEw.js:215:34)
        at js_oGVhFoJSzYmtKkAU7Q-DvVAeEi5XdTX41XcP8FjpYEw.js:399:12
        at HTMLDocument.listener (js_oGVhFoJSzYmtKkAU7Q-DvVAeEi5XdTX41XcP8FjpYEw.js:389:7)
    js_oGVhFoJSzYmtKkAU7Q-DvVAeEi5XdTX41XcP8FjpYEw.js:208 Uncaught TypeError: Cannot read properties of undefined (reading 'close')
  • 🇵🇱Poland Patryk Padus

    @szeidler
    The https://www.drupal.org/project/drupal/issues/2990907 🐛 JsOptimizer preg_replace gives null as return Needs work is not the case. Tested patch on drupal/core (9.5.9) and issue remaining
    Have same console log in panel.
    Element `gutenberg-loading` is over top menu what is issue by itself ;/

  • 🇵🇱Poland Patryk Padus

    Yey, I found solution for this issue and confirm it can be close for good
    I updated from 9.5.9 to 9.5.10 and the issue was gone.
    It is related to: https://www.drupal.org/project/drupal/issues/3222107 🐛 Library order asset weights do not work properly when a large number of javascript files is loaded between two jQuery UI libraries Fixed

    Pleas - after update you need to clear cache.

  • Status changed to Closed: works as designed over 1 year ago
  • 🇮🇳India rushiraval

    This is issue related to Drupal Core. Update the Drupal core. Update core.

    It related to issue : https://www.drupal.org/project/drupal/issues/3222107 🐛 Library order asset weights do not work properly when a large number of javascript files is loaded between two jQuery UI libraries Fixed

Production build 0.71.5 2024