Skip to content

Commit

Permalink
Merge pull request #6894 from webpack/bugfix/css-stuff
Browse files Browse the repository at this point in the history
fixes for mini-css-extract-plugin
  • Loading branch information
sokra committed Mar 29, 2018
2 parents e15df70 + 93a5bf5 commit 4b6ee73
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/Compilation.js
Expand Up @@ -158,8 +158,6 @@ class Compilation extends Tapable {
beforeChunkAssets: new SyncHook([]),
additionalChunkAssets: new SyncHook(["chunks"]),

records: new SyncHook(["compilation", "records"]),

additionalAssets: new AsyncSeriesHook([]),
optimizeChunkAssets: new AsyncSeriesHook(["chunks"]),
afterOptimizeChunkAssets: new SyncHook(["chunks"]),
Expand Down Expand Up @@ -278,6 +276,9 @@ class Compilation extends Tapable {
if (this.cache && this.cache[cacheName]) {
const cacheModule = this.cache[cacheName];

if (typeof cacheModule.updateCacheModule === "function")
cacheModule.updateCacheModule(module);

let rebuild = true;
if (this.fileTimestamps && this.contextTimestamps) {
rebuild = cacheModule.needRebuild(
Expand Down
6 changes: 6 additions & 0 deletions lib/ContextModule.js
Expand Up @@ -45,6 +45,12 @@ class ContextModule extends Module {
throw new Error("options.mode is a required option");
}

updateCacheModule(module) {
this.resolveDependencies = module.resolveDependencies;
this.options = module.options;
this.resolveOptions = module.resolveOptions;
}

prettyRegExp(regexString) {
// remove the "/" at the front and the beginning
// "/foo/" -> "foo"
Expand Down
2 changes: 1 addition & 1 deletion lib/HotUpdateChunkTemplate.js
Expand Up @@ -47,7 +47,7 @@ module.exports = class HotUpdateChunkTemplate extends Tapable {
hotUpdateChunk.removedModules = removedModules;
const modulesSource = Template.renderChunkModules(
hotUpdateChunk,
() => true,
m => typeof m.source === "function",
moduleTemplate,
dependencyTemplates
);
Expand Down
1 change: 1 addition & 0 deletions lib/Module.js
Expand Up @@ -338,5 +338,6 @@ Module.prototype.build = null;
Module.prototype.source = null;
Module.prototype.size = null;
Module.prototype.nameForCondition = null;
Module.prototype.updateCacheModule = null;

module.exports = Module;
9 changes: 9 additions & 0 deletions lib/NormalModule.js
Expand Up @@ -122,6 +122,15 @@ class NormalModule extends Module {
return this.resource;
}

updateCacheModule(module) {
this.userRequest = module.userRequest;
this.parser = module.parser;
this.generator = module.generator;
this.resource = module.resource;
this.loaders = module.loaders;
this.resolveOptions = module.resolveOptions;
}

createSourceForAsset(name, content, sourceMap) {
if (!sourceMap) {
return new RawSource(content);
Expand Down

0 comments on commit 4b6ee73

Please sign in to comment.