WordPress Block Development – trouble importing from @wordpress/icons

I have ran across this before. The code looks fine and this should work. What the error indicates is that those imports are not being found. This can be for several of reasons.

  1. Did you import the @wordpress/icons package through npm?
  2. Is the package a current or recent version? Can run npm outdated to see which packages are outdated.
  3. Is the build properly building? <- this is what got me. My build was building but I was using an old version of @wordpress/scripts which resulted in the icons not being loaded due to a JSX conflict. Once I updated this the icons started loading properly.

Hope this helps and gives you things you can look at.

tech