From 6c8ec1275ff4d980a964dbb42bdaa0cc6ea1859d Mon Sep 17 00:00:00 2001 From: barak igal Date: Fri, 19 Feb 2021 01:04:42 +0200 Subject: [PATCH 01/12] fix: allow consumers to access CssModule Hey, This PR fixes a subtle breaking change happened in the last release. I had an integration that was injecting CssModule instances to the compilation, and it assumed this plugin will take care of them. After the latest release it was impossible for me to get the CssModule class since it cannot be registered twice for serialization. This PR allows others to get access to the CssModule class within same webpack running version. --- src/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 73c34458..d877e412 100644 --- a/src/index.js +++ b/src/index.js @@ -18,8 +18,13 @@ const CODE_GENERATION_RESULT = { runtimeRequirements: new Set(), }; +const cssModuleCache = new WeakMap(); + class MiniCssExtractPlugin { static getCssModule(webpack) { + if(cssModuleCache.has(webpack)) { + return cssModuleCache.get(webpack); + } class CssModule extends webpack.Module { constructor({ context, @@ -133,7 +138,9 @@ class MiniCssExtractPlugin { super.deserialize(context); } } - + + cssModuleCache.set(webpack, CssModule); + if ( webpack.util && webpack.util.serialization && From 9c356e6eb81728362e22b06d5b0e000d9fa5fb2a Mon Sep 17 00:00:00 2001 From: Barak Igal Date: Fri, 19 Feb 2021 15:05:27 +0200 Subject: [PATCH 02/12] Add test for getCssModule --- test/api.test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/api.test.js diff --git a/test/api.test.js b/test/api.test.js new file mode 100644 index 00000000..63113bae --- /dev/null +++ b/test/api.test.js @@ -0,0 +1,10 @@ +import MiniCssExtractPlugin from '../src'; + +import { getCompiler } from './helpers' + +describe('API', () => { + it('should return the same CssModule when same webpack instance provided', () => { + const { webpack } = getCompiler(''); + expect(MiniCssExtractPlugin.getCssModule(webpack)).toEqual(MiniCssExtractPlugin.getCssModule(webpack)); + }); +}); From 5e75309dca8a0ce2ab005c250e537931ee9fbb47 Mon Sep 17 00:00:00 2001 From: Barak Igal Date: Fri, 19 Feb 2021 15:11:37 +0200 Subject: [PATCH 03/12] Add comments for getCssModule cache --- src/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.js b/src/index.js index d877e412..4c64d552 100644 --- a/src/index.js +++ b/src/index.js @@ -18,10 +18,16 @@ const CODE_GENERATION_RESULT = { runtimeRequirements: new Set(), }; +/** + * @type WeakMap + */ const cssModuleCache = new WeakMap(); class MiniCssExtractPlugin { static getCssModule(webpack) { + /** + * Prevent creation of multiple CssModule classes to allow other integrations to get the current CssModule. + */ if(cssModuleCache.has(webpack)) { return cssModuleCache.get(webpack); } From 8be876f85df193a79132ad5a4a44029c4dfee5e3 Mon Sep 17 00:00:00 2001 From: Barak Igal Date: Fri, 19 Feb 2021 15:12:24 +0200 Subject: [PATCH 04/12] fix lint error --- src/index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 4c64d552..4bf57b0e 100644 --- a/src/index.js +++ b/src/index.js @@ -1106,7 +1106,7 @@ class MiniCssExtractPlugin { return usedModules; } - modules = [...modules]; + const modulesList = [...modules]; const [chunkGroup] = chunk.groupsIterable; const moduleIndexFunctionName = @@ -1116,16 +1116,16 @@ class MiniCssExtractPlugin { if (typeof chunkGroup[moduleIndexFunctionName] === 'function') { // Store dependencies for modules - const moduleDependencies = new Map(modules.map((m) => [m, new Set()])); + const moduleDependencies = new Map(modulesList.map((m) => [m, new Set()])); const moduleDependenciesReasons = new Map( - modules.map((m) => [m, new Map()]) + modulesList.map((m) => [m, new Map()]) ); // Get ordered list of modules per chunk group // This loop also gathers dependencies from the ordered lists // Lists are in reverse order to allow to use Array.pop() const modulesByChunkGroup = Array.from(chunk.groupsIterable, (cg) => { - const sortedModules = modules + const sortedModules = modulesList .map((m) => { return { module: m, @@ -1158,7 +1158,7 @@ class MiniCssExtractPlugin { const unusedModulesFilter = (m) => !usedModules.has(m); - while (usedModules.size < modules.length) { + while (usedModules.size < modulesList.length) { let success = false; let bestMatch; let bestMatchDeps; @@ -1240,8 +1240,8 @@ class MiniCssExtractPlugin { // (to avoid a breaking change) // TODO remove this in next major version // and increase minimum webpack version to 4.12.0 - modules.sort((a, b) => a.index2 - b.index2); - usedModules = modules; + modulesList.sort((a, b) => a.index2 - b.index2); + usedModules = modulesList; } this._sortedModulesCache.set(chunk, usedModules); From 8bdcfead03070c78c8ffcbb4f1d5b0a25b843e07 Mon Sep 17 00:00:00 2001 From: Barak Igal Date: Fri, 19 Feb 2021 15:17:45 +0200 Subject: [PATCH 05/12] use imported webpack in api test --- test/api.test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/api.test.js b/test/api.test.js index 63113bae..3a62a219 100644 --- a/test/api.test.js +++ b/test/api.test.js @@ -1,10 +1,11 @@ +import webpack from 'webpack'; + import MiniCssExtractPlugin from '../src'; -import { getCompiler } from './helpers' + describe('API', () => { it('should return the same CssModule when same webpack instance provided', () => { - const { webpack } = getCompiler(''); expect(MiniCssExtractPlugin.getCssModule(webpack)).toEqual(MiniCssExtractPlugin.getCssModule(webpack)); }); }); From 88b9917944469f99a2c40b0b8a5fb2f1ed731dd6 Mon Sep 17 00:00:00 2001 From: Barak Igal Date: Fri, 19 Feb 2021 15:18:57 +0200 Subject: [PATCH 06/12] remove empty space --- test/api.test.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/api.test.js b/test/api.test.js index 3a62a219..2ac001bc 100644 --- a/test/api.test.js +++ b/test/api.test.js @@ -2,8 +2,6 @@ import webpack from 'webpack'; import MiniCssExtractPlugin from '../src'; - - describe('API', () => { it('should return the same CssModule when same webpack instance provided', () => { expect(MiniCssExtractPlugin.getCssModule(webpack)).toEqual(MiniCssExtractPlugin.getCssModule(webpack)); From 73ee1c8b4c1a1743c6e13f6204ae121d1668652c Mon Sep 17 00:00:00 2001 From: Barak Igal Date: Fri, 19 Feb 2021 15:35:56 +0200 Subject: [PATCH 07/12] add CssDependency cache --- src/index.js | 14 +++++++++++++- test/api.test.js | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 4bf57b0e..89c58d98 100644 --- a/src/index.js +++ b/src/index.js @@ -22,13 +22,17 @@ const CODE_GENERATION_RESULT = { * @type WeakMap */ const cssModuleCache = new WeakMap(); +/** + * @type WeakMap + */ +const cssDependencyCache = new WeakMap(); class MiniCssExtractPlugin { static getCssModule(webpack) { /** * Prevent creation of multiple CssModule classes to allow other integrations to get the current CssModule. */ - if(cssModuleCache.has(webpack)) { + if (cssModuleCache.has(webpack)) { return cssModuleCache.get(webpack); } class CssModule extends webpack.Module { @@ -194,6 +198,12 @@ class MiniCssExtractPlugin { } static getCssDependency(webpack) { + /** + * Prevent creation of multiple CssDependency classes to allow other integrations to get the current CssDependency. + */ + if (cssDependencyCache.has(webpack)) { + return cssDependencyCache.get(webpack); + } // eslint-disable-next-line no-shadow class CssDependency extends webpack.Dependency { constructor( @@ -244,6 +254,8 @@ class MiniCssExtractPlugin { } } + cssDependencyCache.set(webpack, CssDependency); + if ( webpack.util && webpack.util.serialization && diff --git a/test/api.test.js b/test/api.test.js index 2ac001bc..09240392 100644 --- a/test/api.test.js +++ b/test/api.test.js @@ -3,7 +3,13 @@ import webpack from 'webpack'; import MiniCssExtractPlugin from '../src'; describe('API', () => { + it('should return the same CssModule when same webpack instance provided', () => { expect(MiniCssExtractPlugin.getCssModule(webpack)).toEqual(MiniCssExtractPlugin.getCssModule(webpack)); }); + + it('should return the same CssDependency when same webpack instance provided', () => { + expect(MiniCssExtractPlugin.getCssDependency(webpack)).toEqual(MiniCssExtractPlugin.getCssDependency(webpack)); + }); + }); From acb66850044722295559fd7371473a0bbaf11172 Mon Sep 17 00:00:00 2001 From: Barak Igal Date: Fri, 19 Feb 2021 15:49:33 +0200 Subject: [PATCH 08/12] removed shared util --- src/index.js | 14 +++----------- src/loader.js | 8 ++++---- src/utils.js | 19 ------------------- 3 files changed, 7 insertions(+), 34 deletions(-) diff --git a/src/index.js b/src/index.js index 89c58d98..57dc6306 100644 --- a/src/index.js +++ b/src/index.js @@ -3,7 +3,7 @@ import { validate } from 'schema-utils'; import schema from './plugin-options.json'; -import { shared, MODULE_TYPE, compareModulesByIdentifier } from './utils'; +import { MODULE_TYPE, compareModulesByIdentifier } from './utils'; const pluginName = 'mini-css-extract-plugin'; @@ -381,16 +381,8 @@ class MiniCssExtractPlugin { } } - // initializeCssDependency - // eslint-disable-next-line no-shadow - const { CssModule, CssDependency } = shared(webpack, (webpack) => { - // eslint-disable-next-line no-shadow - const CssModule = MiniCssExtractPlugin.getCssModule(webpack); - // eslint-disable-next-line no-shadow - const CssDependency = MiniCssExtractPlugin.getCssDependency(webpack); - - return { CssModule, CssDependency }; - }); + const CssModule = MiniCssExtractPlugin.getCssModule(webpack); + const CssDependency = MiniCssExtractPlugin.getCssDependency(webpack); compiler.hooks.thisCompilation.tap(pluginName, (compilation) => { class CssModuleFactory { diff --git a/src/loader.js b/src/loader.js index 450790c9..9b9178f9 100644 --- a/src/loader.js +++ b/src/loader.js @@ -3,9 +3,11 @@ import path from 'path'; import loaderUtils from 'loader-utils'; import { validate } from 'schema-utils'; -import { shared, findModuleById, evalModuleCode } from './utils'; +import { findModuleById, evalModuleCode } from './utils'; import schema from './loader-options.json'; +import MiniCssExtractPlugin from './index'; + const pluginName = 'mini-css-extract-plugin'; function hotLoader(content, context) { @@ -199,9 +201,7 @@ export function pitch(request) { } const count = identifierCountMap.get(dependency.identifier) || 0; - const { CssDependency } = shared(webpack, () => { - return {}; - }); + const { CssDependency } = MiniCssExtractPlugin.getCssDependency(webpack) if (!CssDependency) { throw new Error( diff --git a/src/utils.js b/src/utils.js index 98e5140e..772cd22d 100644 --- a/src/utils.js +++ b/src/utils.js @@ -49,26 +49,7 @@ function compareModulesByIdentifier(a, b) { return compareIds(a.identifier(), b.identifier()); } -const initializeCache = new WeakMap(); - -function shared(webpack, initializer) { - const cacheEntry = initializeCache.get(webpack); - - // eslint-disable-next-line no-undefined - if (cacheEntry !== undefined) { - return cacheEntry; - } - - const constructors = initializer(webpack); - const result = { ...constructors }; - - initializeCache.set(webpack, result); - - return result; -} - export { - shared, MODULE_TYPE, findModuleById, evalModuleCode, From 757bd2514e5015bcba9e6bb6789240589c459b2b Mon Sep 17 00:00:00 2001 From: Barak Igal Date: Fri, 19 Feb 2021 16:02:13 +0200 Subject: [PATCH 09/12] remove destructure --- src/loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loader.js b/src/loader.js index 9b9178f9..c9c9b8af 100644 --- a/src/loader.js +++ b/src/loader.js @@ -201,7 +201,7 @@ export function pitch(request) { } const count = identifierCountMap.get(dependency.identifier) || 0; - const { CssDependency } = MiniCssExtractPlugin.getCssDependency(webpack) + const CssDependency = MiniCssExtractPlugin.getCssDependency(webpack); if (!CssDependency) { throw new Error( From 26b92589801ec19773cbbbb9ef8b4d608818c00d Mon Sep 17 00:00:00 2001 From: Barak Igal Date: Fri, 19 Feb 2021 16:33:03 +0200 Subject: [PATCH 10/12] correct plugin exsit validation --- src/index.js | 10 ++++++++-- src/loader.js | 53 +++++++++++++++++---------------------------------- src/utils.js | 20 +++++++++++++++++++ 3 files changed, 46 insertions(+), 37 deletions(-) diff --git a/src/index.js b/src/index.js index 57dc6306..bf3e0274 100644 --- a/src/index.js +++ b/src/index.js @@ -3,9 +3,10 @@ import { validate } from 'schema-utils'; import schema from './plugin-options.json'; -import { MODULE_TYPE, compareModulesByIdentifier } from './utils'; +import { MODULE_TYPE, compareModulesByIdentifier, provideLoaderContext } from './utils'; -const pluginName = 'mini-css-extract-plugin'; +export const pluginName = 'mini-css-extract-plugin'; +export const pluginSymbol = Symbol(pluginName); const REGEXP_CHUNKHASH = /\[chunkhash(?::(\d+))?\]/i; const REGEXP_CONTENTHASH = /\[contenthash(?::(\d+))?\]/i; @@ -384,6 +385,11 @@ class MiniCssExtractPlugin { const CssModule = MiniCssExtractPlugin.getCssModule(webpack); const CssDependency = MiniCssExtractPlugin.getCssDependency(webpack); + provideLoaderContext(compiler, `${pluginName} loader context`, (loaderContext)=>{ + // eslint-disable-next-line no-param-reassign + loaderContext[pluginSymbol] = true; + }, false) + compiler.hooks.thisCompilation.tap(pluginName, (compilation) => { class CssModuleFactory { // eslint-disable-next-line class-methods-use-this diff --git a/src/loader.js b/src/loader.js index c9c9b8af..39a307dd 100644 --- a/src/loader.js +++ b/src/loader.js @@ -3,12 +3,10 @@ import path from 'path'; import loaderUtils from 'loader-utils'; import { validate } from 'schema-utils'; -import { findModuleById, evalModuleCode } from './utils'; +import { findModuleById, evalModuleCode, provideLoaderContext } from './utils'; import schema from './loader-options.json'; -import MiniCssExtractPlugin from './index'; - -const pluginName = 'mini-css-extract-plugin'; +import MiniCssExtractPlugin, {pluginName, pluginSymbol} from './index'; function hotLoader(content, context) { const accept = context.locals @@ -39,6 +37,12 @@ export function pitch(request) { baseDataPath: 'options', }); + if (!this[pluginSymbol]) { + throw new Error( + "You forgot to add 'mini-css-extract-plugin' plugin (i.e. `{ plugins: [new MiniCssExtractPlugin()] }`), please read https://github.com/webpack-contrib/mini-css-extract-plugin#getting-started" + ); + } + const loaders = this.loaders.slice(this.loaderIndex + 1); this.addDependency(this.resourcePath); @@ -104,33 +108,18 @@ export function pitch(request) { new LimitChunkCountPlugin({ maxChunks: 1 }).apply(childCompiler); - const NormalModule = webpack.NormalModule - ? webpack.NormalModule - : // eslint-disable-next-line global-require - require('webpack/lib/NormalModule'); - - childCompiler.hooks.thisCompilation.tap( - `${pluginName} loader`, - (compilation) => { - const normalModuleHook = - typeof NormalModule.getCompilationHooks !== 'undefined' - ? NormalModule.getCompilationHooks(compilation).loader - : compilation.hooks.normalModuleLoader; - - normalModuleHook.tap(`${pluginName} loader`, (loaderContext, module) => { - if (module.request === request) { - // eslint-disable-next-line no-param-reassign - module.loaders = loaders.map((loader) => { - return { - loader: loader.path, - options: loader.options, - ident: loader.ident, - }; - }); - } + provideLoaderContext(childCompiler, `${pluginName} loader`, (_, module) => { + if (module.request === request) { + // eslint-disable-next-line no-param-reassign + module.loaders = loaders.map((loader) => { + return { + loader: loader.path, + options: loader.options, + ident: loader.ident, + }; }); } - ); + }); let source; @@ -203,12 +192,6 @@ export function pitch(request) { const count = identifierCountMap.get(dependency.identifier) || 0; const CssDependency = MiniCssExtractPlugin.getCssDependency(webpack); - if (!CssDependency) { - throw new Error( - "You forgot to add 'mini-css-extract-plugin' plugin (i.e. `{ plugins: [new MiniCssExtractPlugin()] }`), please read https://github.com/webpack-contrib/mini-css-extract-plugin#getting-started" - ); - } - this._module.addDependency( (lastDep = new CssDependency(dependency, dependency.context, count)) ); diff --git a/src/utils.js b/src/utils.js index 772cd22d..5d8ceb29 100644 --- a/src/utils.js +++ b/src/utils.js @@ -49,7 +49,27 @@ function compareModulesByIdentifier(a, b) { return compareIds(a.identifier(), b.identifier()); } +function provideLoaderContext(compiler, name, handler, thisCompilation = true){ + const NormalModule = compiler.webpack && compiler.webpack.NormalModule + ? compiler.webpack.NormalModule + : // eslint-disable-next-line global-require + require('webpack/lib/NormalModule'); + + compiler.hooks[thisCompilation ? 'thisCompilation': 'compilation'].tap( + name, + (compilation) => { + const normalModuleHook = + typeof NormalModule.getCompilationHooks !== 'undefined' + ? NormalModule.getCompilationHooks(compilation).loader + : compilation.hooks.normalModuleLoader; + + normalModuleHook.tap(name, (loaderContext, module) => handler(loaderContext, module, compilation)); + } + ); +} + export { + provideLoaderContext, MODULE_TYPE, findModuleById, evalModuleCode, From 6785e57157ebd202f07b7d5991e0b2a33af1cabe Mon Sep 17 00:00:00 2001 From: Barak Igal Date: Fri, 19 Feb 2021 17:31:12 +0200 Subject: [PATCH 11/12] fix lint --- src/index.js | 35 +++++++++++++++++++++++------------ src/loader.js | 2 +- src/utils.js | 19 +++++++++++-------- test/api.test.js | 10 ++++++---- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/src/index.js b/src/index.js index bf3e0274..1e3ab17f 100644 --- a/src/index.js +++ b/src/index.js @@ -3,7 +3,11 @@ import { validate } from 'schema-utils'; import schema from './plugin-options.json'; -import { MODULE_TYPE, compareModulesByIdentifier, provideLoaderContext } from './utils'; +import { + MODULE_TYPE, + compareModulesByIdentifier, + provideLoaderContext, +} from './utils'; export const pluginName = 'mini-css-extract-plugin'; export const pluginSymbol = Symbol(pluginName); @@ -31,8 +35,8 @@ const cssDependencyCache = new WeakMap(); class MiniCssExtractPlugin { static getCssModule(webpack) { /** - * Prevent creation of multiple CssModule classes to allow other integrations to get the current CssModule. - */ + * Prevent creation of multiple CssModule classes to allow other integrations to get the current CssModule. + */ if (cssModuleCache.has(webpack)) { return cssModuleCache.get(webpack); } @@ -149,9 +153,9 @@ class MiniCssExtractPlugin { super.deserialize(context); } } - + cssModuleCache.set(webpack, CssModule); - + if ( webpack.util && webpack.util.serialization && @@ -200,8 +204,8 @@ class MiniCssExtractPlugin { static getCssDependency(webpack) { /** - * Prevent creation of multiple CssDependency classes to allow other integrations to get the current CssDependency. - */ + * Prevent creation of multiple CssDependency classes to allow other integrations to get the current CssDependency. + */ if (cssDependencyCache.has(webpack)) { return cssDependencyCache.get(webpack); } @@ -385,10 +389,15 @@ class MiniCssExtractPlugin { const CssModule = MiniCssExtractPlugin.getCssModule(webpack); const CssDependency = MiniCssExtractPlugin.getCssDependency(webpack); - provideLoaderContext(compiler, `${pluginName} loader context`, (loaderContext)=>{ - // eslint-disable-next-line no-param-reassign - loaderContext[pluginSymbol] = true; - }, false) + provideLoaderContext( + compiler, + `${pluginName} loader context`, + (loaderContext) => { + // eslint-disable-next-line no-param-reassign + loaderContext[pluginSymbol] = true; + }, + false + ); compiler.hooks.thisCompilation.tap(pluginName, (compilation) => { class CssModuleFactory { @@ -1126,7 +1135,9 @@ class MiniCssExtractPlugin { if (typeof chunkGroup[moduleIndexFunctionName] === 'function') { // Store dependencies for modules - const moduleDependencies = new Map(modulesList.map((m) => [m, new Set()])); + const moduleDependencies = new Map( + modulesList.map((m) => [m, new Set()]) + ); const moduleDependenciesReasons = new Map( modulesList.map((m) => [m, new Map()]) ); diff --git a/src/loader.js b/src/loader.js index 39a307dd..0f685245 100644 --- a/src/loader.js +++ b/src/loader.js @@ -6,7 +6,7 @@ import { validate } from 'schema-utils'; import { findModuleById, evalModuleCode, provideLoaderContext } from './utils'; import schema from './loader-options.json'; -import MiniCssExtractPlugin, {pluginName, pluginSymbol} from './index'; +import MiniCssExtractPlugin, { pluginName, pluginSymbol } from './index'; function hotLoader(content, context) { const accept = context.locals diff --git a/src/utils.js b/src/utils.js index 5d8ceb29..ae0fc7ff 100644 --- a/src/utils.js +++ b/src/utils.js @@ -49,13 +49,14 @@ function compareModulesByIdentifier(a, b) { return compareIds(a.identifier(), b.identifier()); } -function provideLoaderContext(compiler, name, handler, thisCompilation = true){ - const NormalModule = compiler.webpack && compiler.webpack.NormalModule - ? compiler.webpack.NormalModule - : // eslint-disable-next-line global-require - require('webpack/lib/NormalModule'); - - compiler.hooks[thisCompilation ? 'thisCompilation': 'compilation'].tap( +function provideLoaderContext(compiler, name, handler, thisCompilation = true) { + const NormalModule = + compiler.webpack && compiler.webpack.NormalModule + ? compiler.webpack.NormalModule + : // eslint-disable-next-line global-require + require('webpack/lib/NormalModule'); + + compiler.hooks[thisCompilation ? 'thisCompilation' : 'compilation'].tap( name, (compilation) => { const normalModuleHook = @@ -63,7 +64,9 @@ function provideLoaderContext(compiler, name, handler, thisCompilation = true){ ? NormalModule.getCompilationHooks(compilation).loader : compilation.hooks.normalModuleLoader; - normalModuleHook.tap(name, (loaderContext, module) => handler(loaderContext, module, compilation)); + normalModuleHook.tap(name, (loaderContext, module) => + handler(loaderContext, module, compilation) + ); } ); } diff --git a/test/api.test.js b/test/api.test.js index 09240392..a6e79a6c 100644 --- a/test/api.test.js +++ b/test/api.test.js @@ -3,13 +3,15 @@ import webpack from 'webpack'; import MiniCssExtractPlugin from '../src'; describe('API', () => { - it('should return the same CssModule when same webpack instance provided', () => { - expect(MiniCssExtractPlugin.getCssModule(webpack)).toEqual(MiniCssExtractPlugin.getCssModule(webpack)); + expect(MiniCssExtractPlugin.getCssModule(webpack)).toEqual( + MiniCssExtractPlugin.getCssModule(webpack) + ); }); it('should return the same CssDependency when same webpack instance provided', () => { - expect(MiniCssExtractPlugin.getCssDependency(webpack)).toEqual(MiniCssExtractPlugin.getCssDependency(webpack)); + expect(MiniCssExtractPlugin.getCssDependency(webpack)).toEqual( + MiniCssExtractPlugin.getCssDependency(webpack) + ); }); - }); From 555533a88954d65dd476bb2adcd3d1d75903d8bb Mon Sep 17 00:00:00 2001 From: Barak Igal Date: Sun, 21 Feb 2021 00:34:52 +0200 Subject: [PATCH 12/12] check ci