WordPress JS dependency: wp-route is missing
-
I’m building a React-based admin dashboard and trying to use the
@wordpress/routepackage as documented:
https://developer.wordpress.org/block-editor/reference-guides/packages/packages-route/When running
npm start, the build correctly lists@wordpress/routeas a dependency. However, when enqueuing the compiled script in PHP with the generated dependencies, I encounter an issue because@wordpress/routeis not available as a WordPress-provided script handle.At runtime, the script is enqueued with dependencies similar to:
reactreact-domreact-jsx-runtimewp-elementwp-route(missing)
Since
wp-routedoes not appear to be registered by WordPress core, the script fails to load.I wanted to check whether I’m missing a required step or configuration:
- Is
@wordpress/routeexpected to be registered by WordPress core aswp-route? - Or is there a recommended way to handle this dependency when enqueuing admin scripts?
If there’s an intended setup or best practice for this scenario, I’d appreciate any guidance.
The page I need help with: [log in to see the link]
You must be logged in to reply to this topic.