Skip to content

Instantly share code, notes, and snippets.

@limarc
Last active October 28, 2015 12:02
Show Gist options
  • Select an option

  • Save limarc/e041b89056d29ac0ef79 to your computer and use it in GitHub Desktop.

Select an option

Save limarc/e041b89056d29ac0ef79 to your computer and use it in GitHub Desktop.
var sha1 = require('sha1');
function WebpackSortingFix() {}
WebpackSortingFix.prototype.apply = function(compiler) {
compiler.plugin('compilation', function(compilation) {
compilation.plugin('optimize-modules', function(modules) {
for (var index in modules) {
var module = modules[index];
if (typeof module === 'object' && module.id !== 0) {
modules[index].id = sha1(String(module.resource));
}
}
});
});
};
module.exports = WebpackSortingFix;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment