Unverified Commit 3f51f0ed authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Add support for CSS Module patching (#8957)

parent 3762e757
...@@ -921,7 +921,8 @@ export default async function getBaseWebpackConfig( ...@@ -921,7 +921,8 @@ export default async function getBaseWebpackConfig(
use && use &&
typeof use === 'object' && typeof use === 'object' &&
// Identify use statements only pertaining to `css-loader` // Identify use statements only pertaining to `css-loader`
use.loader === 'css-loader' && (use.loader === 'css-loader' ||
use.loader === 'css-loader/locals') &&
use.options && use.options &&
typeof use.options === 'object' && typeof use.options === 'object' &&
// The `minimize` property is a good heuristic that we need to // The `minimize` property is a good heuristic that we need to
...@@ -963,10 +964,7 @@ export default async function getBaseWebpackConfig( ...@@ -963,10 +964,7 @@ export default async function getBaseWebpackConfig(
// ... resolve the version of `css-loader` shipped with that // ... resolve the version of `css-loader` shipped with that
// package instead of whichever was hoisted highest in your // package instead of whichever was hoisted highest in your
// `node_modules` tree. // `node_modules` tree.
const correctCssLoader = resolveRequest( const correctCssLoader = resolveRequest(use.loader, correctNextCss)
'css-loader',
correctNextCss
)
if (correctCssLoader) { if (correctCssLoader) {
// We saved the user from a failed build! // We saved the user from a failed build!
use.loader = correctCssLoader use.loader = correctCssLoader
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment