Skip to content

Commit

Permalink
removing the flags
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekbh committed Dec 2, 2020
1 parent ca46378 commit 372435b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
8 changes: 1 addition & 7 deletions packages/next/next-server/lib/post-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,7 @@ function sourceIsSupportedType(imgSrc: string): boolean {
}

// Initialization
registerPostProcessor(
'Inline-Fonts',
new FontOptimizerMiddleware(),
// Using process.env because passing Experimental flag through loader is not possible.
// @ts-ignore
(options) => options.optimizeFonts || process.env.__NEXT_OPTIMIZE_FONTS
)
registerPostProcessor('Inline-Fonts', new FontOptimizerMiddleware(), () => true)

registerPostProcessor(
'Preload Images',
Expand Down
22 changes: 10 additions & 12 deletions packages/next/next-server/server/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1051,18 +1051,16 @@ export async function renderToHTML(
}

// Avoid postProcess if both flags are false
if (process.env.__NEXT_OPTIMIZE_FONTS || process.env.__NEXT_OPTIMIZE_IMAGES) {
html = await postProcess(
html,
{
getFontDefinition,
},
{
optimizeFonts: renderOpts.optimizeFonts,
optimizeImages: renderOpts.optimizeImages,
}
)
}
html = await postProcess(
html,
{
getFontDefinition,
},
{
optimizeFonts: true,
optimizeImages: renderOpts.optimizeImages,
}
)

if (renderOpts.optimizeCss) {
// eslint-disable-next-line import/no-extraneous-dependencies
Expand Down

0 comments on commit 372435b

Please sign in to comment.