You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generation spritesmith file in a multi-page project. For index it is formed normally, for another writes error Module not found: Error: Can not resolve './sprite.png' in ' \ webpack_template \ source \ pages \ blog'.
The file with the picture sprite.png is formed in the folder with the main entry, where the index files are, otherwise it does not work either.
How to solve this problem?
Here's my template. https://github.com/OrionPro/webpack_template
ps Sorry for my English
The text was updated successfully, but these errors were encountered:
I solved this problem by adding another new SpritesmithPlugin to create sprite.png on the new page. I think it's a crutch (not a good solution) ... but working).
Probably that is because by saying cssImageRef: "sprite.png" you are trying to access sprite.png by relative http path.
It is not correct in general. It has to be either absolute http path, or "absolute" webpack path.
First option in your case should be something like cssImageRef: "/source/img/sprite.png".
I prefer second though. To make it work you have to change cssImageRef: "sprite.png" to cssImageRef: "~sprite.png" and configure webpack resolver with resolve.modules or resolve.alias. https://webpack.js.org/configuration/resolve/
Generation spritesmith file in a multi-page project. For index it is formed normally, for another writes error Module not found: Error: Can not resolve './sprite.png' in ' \ webpack_template \ source \ pages \ blog'.
The file with the picture sprite.png is formed in the folder with the main entry, where the index files are, otherwise it does not work either.
How to solve this problem?
Here's my template. https://github.com/OrionPro/webpack_template
ps Sorry for my English
The text was updated successfully, but these errors were encountered: