[wp-trac] [WordPress Trac] #61387: Interactivity API: not working in classic theme

WordPress Trac noreply at wordpress.org
Thu Jun 6 09:54:29 UTC 2024


#61387: Interactivity API: not working in classic theme
-------------------------------+------------------------------
 Reporter:  swissspidy         |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Interactivity API  |     Version:  6.5
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+------------------------------

Comment (by jonsurrell):

 Replying to [ticket:61387 swissspidy]:

 > In a classic theme, there is no `modulepreload` for the
 `@wordpress/interactivity` module, so naturally my script doesn't work and
 throws an error because of the missing module.

 `modulepreload` is an optimization and should not be strictly necessary.
 It's essential for a `<script type="importmap">` (with
 `@wordpress/dependency` in the `imports` object) to be printed.

 > [my script] throws an error because of the missing module.

 What is the exact error? Is it an unresolved module specifier like this?

 > TypeError: Failed to resolve module specifier
 "@wordpress/interactivity".

 I suspect your module is missing a dependency on
 `@wordpress/interactivity`, but it's working in some themes because parts
 of the theme add this module dependency. How is it being built? Is
 `@wordpress/interactivity` listed as a dependency in its asset file or
 where it's enqueued?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61387#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list