Console errors when JS aggregation is on

Created on 9 December 2022, almost 2 years ago
Updated 5 July 2023, over 1 year ago

I get the console error "Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://www.site.ca/node/1/worker-html.js' failed to load." when using JS aggregation.

The ace editor still works, but I cannot do search, etc, in the editor.

Could be related to https://www.drupal.org/project/ace_editor/issues/2090921 β†’

πŸ› Bug report
Status

Active

Version

1.4

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada jglynn

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States angrytoast Princeton, NJ

    Adding a patch for this bug that looks to work for both 1.4.0 and 2.0.0-alpha1 as of 2023-07-05.

    It adds a general setup.js that calls ace.config.set('basePath') to make sure it has the value of the discovered library path from the module.

  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States angrytoast Princeton, NJ
  • πŸ‡ΊπŸ‡ΈUnited States angrytoast Princeton, NJ

    A quick update to the previous patch in #3. Currently ace_editor_lib_path doesn't cache its discovered library path so it must run through the filesystem each time it is run. Because the patch adds a hook_page_attachments implementation to populate drupalSettings, it's helpful to cache the path for future use.

    A better solution would be to introduce a service that can be used in both procedural code and the various plugins this module provides but that seems like a bigger refactor that should be tackled separately.

  • πŸ‡ΊπŸ‡ΈUnited States angrytoast Princeton, NJ

    Following up again, here's a slightly different approach that limits the drupalSettings addition by not using hook_page_attachments. Instead it adds them in the respective plugin files so that it's only added when needed, which feels better.

    That said, we only use the filter functionality. I can confirm it works there, but can't confirm for the AceFormatter use case. I'm also not familiar with editor plugins so the base_path isn't added there to drupalSettings and will need more work.

  • Status changed to Needs work 5 months ago
  • πŸ‡―πŸ‡΄Jordan Rajab Natshah Jordan

    Needs an updated issue fork and MR

  • First commit to issue fork.
  • πŸ‡§πŸ‡ͺBelgium klaasvw

    I've pushed a MR again 2.0.x containing the changes from #5.

    This version will only add the setting if one of the ace_editor libraries is loaded.

    Also note that not only the Ace basePath is set but also the theme-, worker- and modePath.

Production build 0.71.5 2024