fix(nuxt): don't inline styles for per-request ssr: false (#8106)

Co-authored-by: Alex C <alex.canals@jkweb.ch>
This commit is contained in:
Alex 2022-10-12 10:50:16 +02:00 committed by GitHub
parent bda187c1be
commit 6ef6eae2c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -205,7 +205,7 @@ export default defineRenderHandler(async (event) => {
const renderedMeta = await ssrContext.renderMeta?.() ?? {} const renderedMeta = await ssrContext.renderMeta?.() ?? {}
// Render inline styles // Render inline styles
const inlinedStyles = process.env.NUXT_INLINE_STYLES const inlinedStyles = process.env.NUXT_INLINE_STYLES && !(process.env.NUXT_NO_SSR || ssrContext.noSSR)
? await renderInlineStyles(ssrContext.modules ?? ssrContext._registeredComponents ?? []) ? await renderInlineStyles(ssrContext.modules ?? ssrContext._registeredComponents ?? [])
: '' : ''

View File

@ -598,7 +598,7 @@ describe.skipIf(process.env.NUXT_TEST_DEV || process.env.TEST_WITH_WEBPACK)('inl
'{--assets:"assets"}', // <script> '{--assets:"assets"}', // <script>
'{--scoped:"scoped"}', // <style lang=css> '{--scoped:"scoped"}', // <style lang=css>
'{--postcss:"postcss"}', // <style lang=postcss> '{--postcss:"postcss"}', // <style lang=postcss>
'{--global:"global"}', // entryfile dependency '{--global:"global"', // entryfile dependency
'{--plugin:"plugin"}', // plugin dependency '{--plugin:"plugin"}', // plugin dependency
'{--functional:"functional"}' // functional component with css import '{--functional:"functional"}' // functional component with css import
]) { ]) {

View File

@ -1,3 +1,4 @@
:root { :root {
--global: 'global'; --global: 'global';
--asset: url('~/assets/logo.svg');
} }