WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.32k stars 4.12k forks source link

Uncaught TypeError: The specifier “@wordpress/interactivity” Relative module specifiers must start with “./”, “../” or “/” #63221

Closed rosa2 closed 1 month ago

rosa2 commented 2 months ago

Description

Hello and thanks for all your work in WordPress

I use Dokan-lite that allows to have a multivendor site. When I edit as a vendor a product I get this error:

Uncaught TypeError: The specifier “@wordpress/interactivity” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.

I searched and found little about it and one that gave to me the solution:

Firefox es seems to have trouble with "@wordpress/interactivity" in the file “wp-includes/blocks/navigation/view.min.js” – it returns that same Uncaught TypeError.

If I change the beginning of that file from

import*as e from"@wordpress/interactivity"

to

import*as e from"/wp-includes/js/dist/interactivity.min.js"

They say that it happens with Firefox, but I have that problem also with Chromium version 108.0.5359.40 (Developer Build) Ubuntu 22.04 (64-bit). My Firefox version 127.0.2 (64 bits).

I have made the proposed solution, and the error has gone, but, of course, when I update WordPress, I would have to make it again if it is not changed.

I can't test it only with Guttemberg because the error comes with Dokan-lite, but other users report with other modules that use interactivity.

https://wordpress.org/support/topic/auto-prefetch-urls-on-mouse-hover-not-working-with-wp-6-5-interactivity-api/ https://wordpress.org/support/topic/wordpress-navigation-overlay-menu-not-working-with-firefox-115/ https://wordpress.org/support/topic/when-the-plugin-is-activated-the-default-lightbox-feature-stops-working/ https://mytory.net/archives/15766 https://wordpress.org/support/topic/console-error-with-gutenberg-plug-in/

Thanks again for your great work :)

Step-by-step reproduction instructions

  1. Install WordPress 6.5.5 and Dokan-lite 3.11.3
  2. Create a user with role vendor
  3. Create a product with that user
  4. The error appears in both browsers developer console

Screenshots, screen recording, code snippet

No response

Environment info

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

cbravobernal commented 2 months ago

Hi @rosa2 !

It seems to be an issue related to how the plugin is loading the assets. Interactivity API is a script module, and some plugins must update how they load JS assets.

https://make.wordpress.org/core/2024/03/04/script-modules-in-6-5/ https://core.trac.wordpress.org/ticket/61500

While we are working on improve modules interoperability, we recommend to contact to the plugin developers so they can handle how to load script modules.

cbravobernal commented 1 month ago

Closing this PR, let us know if need something else!