-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(webpack): added workaround for ssr styles
- Loading branch information
1 parent
c90eed2
commit 663318d
Showing
5 changed files
with
127 additions
and
72 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
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 |
---|---|---|
@@ -1,17 +1,25 @@ | ||
import initHook from '../hookFunctions/nitro/init.mjs'; | ||
import { isViteBuild } from '../utils.mjs'; | ||
import { isViteBuild, isWebpackBuild, logger } from '../utils.mjs'; | ||
|
||
export function optimizePreloads(moduleOptions, nuxt) { | ||
const disableNuxtCritters = moduleOptions.disableNuxtCritters; | ||
nuxt.options.experimental.inlineSSRStyles = false; | ||
|
||
if (isViteBuild(nuxt)) { | ||
nuxt.options.vite.build.manifest = false; | ||
if (disableNuxtCritters) { | ||
nuxt.options.vite.build.cssCodeSplit = false; | ||
} | ||
} else if (isWebpackBuild(nuxt)) { | ||
nuxt.options.webpack.extractCSS = true; | ||
logger.info(`Use workaround for \`SSR Styles\` in \`Webpack\`.`); | ||
} | ||
|
||
nuxt.options.experimental.inlineSSRStyles = false; | ||
|
||
nuxt.hook('nitro:init', initHook(nuxt, disableNuxtCritters)); | ||
const hookOptions = { | ||
disableNuxtCritters: | ||
typeof disableNuxtCritters !== 'undefined' ? disableNuxtCritters : true, | ||
manifest: null | ||
}; | ||
nuxt.hook('build:manifest', manifest => (hookOptions.manifest = manifest)); | ||
nuxt.hook('nitro:init', initHook(nuxt, hookOptions)); | ||
} |