We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9796ac3 commit d59b28eCopy full SHA for d59b28e
src/index.js
@@ -172,7 +172,15 @@ class ExtractCssChunks {
172
}
173
174
compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
175
- compilation.hooks.normalModuleLoader.tap(pluginName, (lc, m) => {
+ let { normalModuleLoader } = compilation.hooks; // Webpack 4
176
+ if (!normalModuleLoader) {
177
+ // Webpack 5+
178
+ // eslint-disable-next-line global-require
179
+ const NormalModule = require('webpack/lib/NormalModule');
180
+ normalModuleLoader = NormalModule.getCompilationHooks(compilation).loader;
181
+ }
182
+
183
+ normalModuleLoader.tap(pluginName, (lc, m) => {
184
const loaderContext = lc;
185
const module = m;
186
loaderContext[MODULE_TYPE] = (content) => {
0 commit comments