forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ESLint Ignores and Extract Fn (vercel#10205)
- Loading branch information
Showing
8 changed files
with
122 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/next/build/webpack/config/blocks/css/overrideCssConfiguration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Configuration, RuleSetRule } from 'webpack' | ||
import { getPostCssPlugins } from './plugins' | ||
|
||
export async function __overrideCssConfiguration( | ||
rootDirectory: string, | ||
isProduction: boolean, | ||
config: Configuration | ||
) { | ||
const postCssPlugins = await getPostCssPlugins(rootDirectory, isProduction) | ||
|
||
function patch(rule: RuleSetRule) { | ||
if ( | ||
rule.options && | ||
typeof rule.options === 'object' && | ||
rule.options['ident'] === '__nextjs_postcss' | ||
) { | ||
rule.options.plugins = postCssPlugins | ||
} else if (Array.isArray(rule.oneOf)) { | ||
rule.oneOf.forEach(patch) | ||
} else if (Array.isArray(rule.use)) { | ||
rule.use.forEach(u => { | ||
if (typeof u === 'object') { | ||
patch(u) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
config.module?.rules?.forEach(entry => { | ||
patch(entry) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.