Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(nuxt): lazy-load entry CSS #8278

Merged
merged 4 commits into from Oct 18, 2022
Merged

fix(nuxt): lazy-load entry CSS #8278

merged 4 commits into from Oct 18, 2022

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

resolves nuxt/nuxt#14953

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

With nuxt-contrib/vue-bundle-renderer#39, we are now not blocking render with stylesheet, but we still need to load entry CSS on client side to include client-only CSS (among other things). This PR:

  1. adds back support for rendering inline styles for ssr: false routes: fix(nuxt): don't inline styles for per-request ssr: falseΒ #8106
  2. adds in lazy css links which use onload media strategy to load CSS on client-side only

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe added bug Something isn't working πŸ”¨ p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage labels Oct 18, 2022
@danielroe danielroe requested a review from pi0 October 18, 2022 10:50
@danielroe danielroe self-assigned this Oct 18, 2022
@codesandbox
Copy link

codesandbox bot commented Oct 18, 2022

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@netlify
Copy link

netlify bot commented Oct 18, 2022

βœ… Deploy Preview for nuxt3-docs canceled.

Name Link
πŸ”¨ Latest commit 271f834
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/634e903135ca5400085ac1e1

// @ts-ignore
globalThis.__buildAssetsURL = buildAssetsURL
// @ts-ignore
globalThis.__publicAssetsURL = publicAssetsURL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't they register as side-effects of #paths? (and if they do, do we still need it from #paths?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They aren't registered as globals there.

And yes, we probably could wrap these lines in if (process.client) - will try:

'globalThis.__buildAssetsURL = buildAssetsURL',
'globalThis.__publicAssetsURL = publicAssetsURL'

@danielroe danielroe requested a review from pi0 October 18, 2022 15:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x bug Something isn't working πŸ”¨ p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

prevent loading global style entry css file
2 participants