Description
Original discussion: #284
ID of CssModule
is currently set to empty string during initialization. When module ID is somehow empty, NamedModulesPlugin
inside webpack creates name like ?abcdef
. For regular ones (or Normal
in webpack's nomenclature) it outputs something like ./foo/bar/baz.js?abcdef
. Until that ?...
hash is based on FULL request path (ex. /home/user/projects/foo/bar/baz.js
), it's different for different repository clones, ex. on different workstations and on CI. It makes file hashes quite unpredictable as sorting modules by id gives different results on different machines and hash calculation depends on that order (hash.update('a') && hash.update('b')
gives different results than hash.update('b') && hash.update('a')
). It may be an issue even on CI, if repository is cloned to directory prefixed with build ID, so absolute path differs from build to build. In the worst case, file hash changes when its contents did not change, so the whole idea of hashing loses its sense.
The issue was discussed already in https://github.com/webpack-contrib/mini-css-extract-plugin/issues/281#issuecomment-423300860
, but for some not obvious reason soultion proposed by @lfre was rejected.