-
-
Notifications
You must be signed in to change notification settings - Fork 609
Same file name but different directory, after build hash is same.(use css module) #464
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
Comments
I'm having the same issue. I also tried changing
but to no avail. It creates same classes with same hashes (even with 7). |
Btw, #413 also talks about same issue |
Same problem here (webpack 2) |
I found some workarounds while trying to debug my issue. This is the code responsible for resolving the /*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var loaderUtils = require("loader-utils");
var path = require("path");
module.exports = function getLocalIdent(loaderContext, localIdentName, localName, options) {
if(!options.context)
options.context = loaderContext.options && typeof loaderContext.options.context === "string" ? loaderContext.options.context : loaderContext.context;
var request = path.relative(options.context, loaderContext.resourcePath);
options.content = options.hashPrefix + request + "+" + localName;
localIdentName = localIdentName.replace(/\[local\]/gi, localName);
var hash = loaderUtils.interpolateName(loaderContext, localIdentName, options);
return hash.replace(new RegExp("[^a-zA-Z0-9\\-_\u00A0-\uFFFF]", "g"), "-").replace(/^((-?[0-9])|--)/, "_$1");
}; As you can see, even if you set Workaround 1: Add the Workaround 2: Define your own resolving function by adding (While this works for me, I don't have much experience with css-loader to make a PR or suggest that this should be the default behaviour) |
@hugorodrigues thx I will check that solution, we plan to overhaul css-loader in |
Dir1 (test.css)
.input { display: block }
Dir2 (test.css)
.input { display: none }
Webpack loader options
loader: 'style-loader!css-loader?sourceMap&modules&hashPrefix=23&importLoaders=1&localIdentName=[path][name]-[local]--[hash:base64:5]!postcss-loader?sourceMap&sourceComments',
After Build
The class name is conflict.
The text was updated successfully, but these errors were encountered: