importmap @wordpress/interactivity
-
So this is in relation to the move to using modules and importmap.
we had a persistent, although intermittent error of:
“The specifier “@wordpress/interactivity” Relative module specifiers must start with “./”, “../” or “/”
Looking at the code the wordpress core importmap declaration is made via WP_Script_Modules with an add_action in wp_head which causes it to load after plugins enqueue scripts
As a result we encountered issues with the declaration occuring after modules need to be loaded. We found that making the declaration using wp_print_scripts we could add the importmap code before enqueue scripts fired and this resolved the error although now we have two script tags forThe issue of the “@wordpress/interactivity” Relative module specifiers” was intermittent and buggy and presumably down to plugins (we were running this with woocommerce and think that may have been the issue.
has anybody else had this issue? the fix we have seems a bit dodgy although it seems to work. If anybody else has suggestions as to how best to debug this error for a more robust fix or a way to remove the initial importmap declaration that would also be much appreciated.
Please ELI5
The topic ‘importmap @wordpress/interactivity’ is closed to new replies.