Issue with asset/modules, while loading the image through css, with frontend and backend server being different. #18437
Unanswered
Chinmay2709
asked this question in
Q&A
Replies: 1 comment 2 replies
-
What is |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Before I explain the issue that I have in my case, here is my general info:
![webpack-cli INFO](https://private-user-images.githubusercontent.com/107140611/332595365-3dc47c48-4d31-417c-b6f0-f12f76d30afc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAzMzUyNjgsIm5iZiI6MTcyMDMzNDk2OCwicGF0aCI6Ii8xMDcxNDA2MTEvMzMyNTk1MzY1LTNkYzQ3YzQ4LTRkMzEtNDE3Yy1iNmYwLWYxMmY3NmQzMGFmYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzA3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcwN1QwNjQ5MjhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00YTM5ODMxZGY1YWRmZTAwNDk1M2ViMzA1MTNkMzY5ODgwMTdjYTQyYWY4ODNlZmZhMmJkZjM2Nzc0NjFjMzkxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.MeA-T7DjOfo2PnC18avR66Xe2vaWUVjVbWIbOesW__4)
Now, here is my project description:
Now coming back to problem.
So far everything was working fine, since I'm using web-pack V-5, I was aware that the url-loader and file-loader are depreciated, and instead asset/modules are introduced. Therefore, that's what I used, here is my webpack.config.js :
Even after that when I run my project I, couldn't load my Image to the project:
Now, here is what I found, the problem was never with web-pack or with my path inside my main.css file which has property(background-image) with url for the image. I found that the problem is with the dynamic URL with hash for image that is loaded by the web-pack, since I am using a different PORT ( 8080 ) for my bundle.js, the web-pack loads the file with URL without the port number, which creates a problem. Here, is how when I change or add port number to URL, image seems to be loading.
Now here is my question:
Is there a way I can give correct port to the web-pack so that it knows the correct URL to reach my asset ? or if not then what should be my approach, given that my back-end would remain on python, since I have specific use for the language.
Thanks~
Beta Was this translation helpful? Give feedback.
All reactions