Skip to content

Commit

Permalink
fix(index): assign empty module.id to prevent contenthash from ch…
Browse files Browse the repository at this point in the history
…anging unnecessarily (#284)

* fix: add empty id to prevent contenthash from changing unnecessarily

* fix: updated tests
  • Loading branch information
lfre authored and evilebottnawi committed Oct 2, 2018
1 parent aa993da commit d7946d0
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/index.js
Expand Up @@ -42,6 +42,7 @@ class CssDependencyTemplate {
class CssModule extends webpack.Module {
constructor(dependency) {
super(MODULE_TYPE, dependency.context);
this.id = '';
this._identifier = dependency.identifier;
this._identifierIndex = dependency.identifierIndex;
this.content = dependency.content;
Expand Down Expand Up @@ -92,7 +93,7 @@ class CssModule extends webpack.Module {
super.updateHash(hash);
hash.update(this.content);
hash.update(this.media || '');
hash.update(JSON.stringify(this.sourceMap || ''));
hash.update(this.sourceMap ? JSON.stringify(this.sourceMap) : '');
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/cases/composes-async/expected/1.css
@@ -1,4 +1,4 @@
.base {
background: blue;
.composed {
background: green;
}

4 changes: 2 additions & 2 deletions test/cases/composes-async/expected/2.css
@@ -1,4 +1,4 @@
.composed {
background: green;
.base {
background: blue;
}

This file was deleted.

0 comments on commit d7946d0

Please sign in to comment.