Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

Commit

Permalink
Use loaderUtils.stringifyRequest
Browse files Browse the repository at this point in the history
Since webpack calculates the hash before module paths are translated into module ids, we must avoid absolute paths to ensure consistent hashes across different compilations.
  • Loading branch information
Obi-Dann authored May 17, 2017
1 parent 36836d6 commit 6e8f7de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = function(content) {
return content + `
if(module.hot) {
// ${Date.now()}
const cssReload = require('${require.resolve('./hotModuleReplacement')}')(${JSON.stringify(options)});
const cssReload = require(${loaderUtils.stringifyRequest(this, require.resolve('./hotModuleReplacement'))})(${JSON.stringify(options)});
module.hot.dispose(cssReload);
module.hot.accept(undefined, cssReload);
}
Expand Down

0 comments on commit 6e8f7de

Please sign in to comment.