I have a js tool that imports a js library I have created. This library relies on there being a file called "failed.png". I bundle both the package and the library using webpack. If I use the library on its own then the image is pulled into the dist directory using the file-loader. Thats great and all is well. Then when I try to import the library from my js tool and it cannot find the image because its now looking in the js tool's dist directory and not the library's dist directory.
So my ideal solution would be a way to have the library know to look in its own dist directory inside node_modules for its own images. Failing that then the next best thing would be to pull the images required from within the library's dist directory and put them in the tool's dist directory.
There is a potential solution here Include assets from webpack bundled npm package but I don't like it because it requires the package to have intimate knowledge of the library it is importing such as where it stores its assets. I'm assuming that other libraries have similar internal dependencies and don't rely on the user modifying there webpack file to get them to work.
Does anyone have any idea how to accomplish this with webpack?