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
I believe it's quite common to use resolver-url-loader to ensure the relative path of image is working in scss.
However, it seems like I can't find any documentation in the upgrade guide that talks about this particular changes.
Error
Error 1: Failed to resolve image path used in scss (Resolved)
Module not found: Error: Can't resolve '../assets/images/bar.png' in '/sample/app/javascript/packs'resolve '../assets/images/bar.png' in '/sample/app/javascript/packs' using description file: /sample_app/package.json (relative path: ./app/javascript/packs) using description file: /sample_app/package.json (relative path: ./app/javascript/assets/images/bar.png)
Error 2: Similar to issues, #1267 & #1119, after upgrading to webpacker 6, it failed to resolve bootstrap glyhicons with previous workaround mentioned in #1119 (comment)
Module not found: Error: Can't resolve '../fonts/bootstrap/glyphicons-halflings-regular.svg' in '/sample/app/javascript/packs'resolve '../fonts/bootstrap/glyphicons-halflings-regular.svg' in '/sample/app/javascript/packs' using description file: /sample_app/package.json (relative path: ./app/javascript/packs) using description file: /sample_app/package.json (relative path: ./app/javascript/assets/images/bar.png)
...
constcustomConfig={context: path.resolve(__dirname,'../../app/javascript'),// Default webpacker setup, old setup was app/javascripts, this is the value from webpacker.yml "source_path"// ...rest of your customConfig goes here}// you may need to update relative path in scss as well, eg. update url('../assets/...') to url('../../assets/..')
Any guidance/insight regarding on how to resolve bootstrap glyphicons would be much appreciated 🙏 .
The text was updated successfully, but these errors were encountered:
kimyu92
changed the title
Webpacker 6: Missing documentation on how to migrate from resolve-url-loader
Webpacker 6: Missing documentation on how to resolve images or fonts used in scss
Nov 10, 2021
This seems to be related to resolve-url-loader instead of webpacker upgrade.
However, for those who encounter issue using resolve-url-loader >= 3 to import images in scss file,
I ended up using solution here where I create an alias for image directory in webpack custom.js and then instead of using relative path, I point it to url('~images/x.png')
I believe it's quite common to use
resolver-url-loader
to ensure the relative path of image is working in scss.However, it seems like I can't find any documentation in the upgrade guide that talks about this particular changes.
Error
Error 1: Failed to resolve image path used in scss (Resolved)
Error 2: Similar to issues, #1267 & #1119, after upgrading to webpacker 6, it failed to resolve bootstrap glyhicons with previous workaround mentioned in #1119 (comment)
Folder structure
Webpack config
System
Update
To resolve relative image used in scss
/config/webpack/base.js
Any guidance/insight regarding on how to resolve bootstrap glyphicons would be much appreciated 🙏 .
The text was updated successfully, but these errors were encountered: