So I’m just getting used to Webpack, and I got stuck at including plugin assets, specifically when it comes to images.
Let’s say there’s a WordPress plugin with assets like:
Including the styles and scripts is pretty simple, I could just use
import to include them, and they’d be compiled into my CSS ans JS files just fine. However when assets like images are being referenced, things will break, presumably because the relative path changes from the plugin
styles directory to the themes
styles directory, so one ends up with errors like:
error in ./resources/assets/styles/plugins.scss
Module build failed: ModuleNotFoundError: Module not found: Error: Can’t resolve ‘…/images/image.png’ in ‘…\resources\assets\styles’
I’m wondering if there’s some kind of built-in way of handling this?