JavaScript for WordPress Forums Gutenberg Development Plugin path in index.js file Reply To: Plugin path in index.js file

Zac Gordon

Great question.

To give some context to how things are done in the React world of WordPress going forward, you would want to import your SVG images directly into your JS code (like we do with the SVG icons in the examples).

This article goes into more depth on the topic:

But the short answer is, that is not the way you want to approach this problem. You want to add the SVG file to your plugin folder architecture then import the SVG file using a relative file path and JavaScript imports. This will also require an appropriate webpack loader for SVG files.

Hope that helps you get moving in the right direction!