-
-
Notifications
You must be signed in to change notification settings - Fork 601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong URL for background images #1380
Comments
|
Or use |
So what's the solution for people who don't want to migrate yet? |
Keep using v5 if you don't want to migrate or set |
@amlbar in the latest version they (I don't know why) made images automatically be substituted with a hash value for the file name. You can turn this off by setting |
Do you have |
@alexander-akait its got nothing to do with file loader (though it is a possibility) css-loader need to be explicitly told to not use hashing for the file names. |
css-loader doesn't use hashes, file-loader is deprecated and you can have problems with hashes if you use it |
I see the error of my ways (I reread the docs) seems as though I solved my
problem accidentally by preventing it from touching urls.
(I was working on a bulk migration from webpack 4 to 5. Way too many deps
to figure out what needed to removed/changed due to deprecation)
…On Thu, Apr 7, 2022, 8:42 PM Alexander Akait ***@***.***> wrote:
css-loader doesn't use hashes, file-loader is deprecated and you can have
problems with hashes if you use it
—
Reply to this email directly, view it on GitHub
<#1380 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABLOEBTHVHQE3E6SSVBD6SLVD56HJANCNFSM5EKMK5VQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
So what is the fix to get the reference object that is generated to reference the generated sprite.svg file. Instead of the export default { id: '', viewBox: '', url: '', toString: ''} |
Bug report
The css-loader does not give me the correct url for my css build like when using
background: url(***);
. The url is being hashed automatically even setting it in file-loader option to not use a hash for the filename. I also set the file-loader optionemitFile: false;
and then the finished build has still emitted a file for that url. This bug exists since [email protected].Actual Behavior
The url in my Sass file is in this form:
The output url is converted to something like:
And the build emitted a new file
86b5f32909e54c79331e.svg
with the content inside it likeexport default "../img/shapes.svg";
Expected Behavior
The url in my Sass file is in this form:
The output url should be converted to this:
And there should be no additional images created or emitted after build.
How Do We Reproduce?
You can clone my sample project with minimal code in it here in https://github.com/amlbar/webpack-build-css-with-bug and run on your local machine. For this project, you need to manually change the js and css source in the index.html. (It is handled automatically by django webpack loader in my real project)
Please paste the results of
npx webpack-cli info
here, and mention other relevant informationThe text was updated successfully, but these errors were encountered: