Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const {
Template,
util: { createHash },
} = webpack;
const {
SyncWaterfallHook,
} = require("tapable");

const MODULE_TYPE = 'css/mini-extract';

Expand Down Expand Up @@ -129,6 +132,8 @@ class MiniCssExtractPlugin {

apply(compiler) {
compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
compilation.hooks.miniCssExtractPluginBeforeLinkAppend = new SyncWaterfallHook(['source', 'chunk', 'hash'])

compilation.dependencyFactories.set(
CssDependency,
new CssModuleFactory()
Expand Down Expand Up @@ -377,6 +382,7 @@ class MiniCssExtractPlugin {
])
: '',
'var head = document.getElementsByTagName("head")[0];',
compilation.hooks.miniCssExtractPluginBeforeLinkAppend.call('', chunk, hash),
'head.appendChild(linkTag);',
]),
'}).then(function() {',
Expand Down