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

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

Merged
pi0 merged 4 commits intomainfrom
fix/lazy-css
Oct 18, 2022
Merged

fix(nuxt): lazy-load entry CSS#8278
pi0 merged 4 commits intomainfrom
fix/lazy-css

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
@pi0 pi0 merged commit cfaa462 into main Oct 18, 2022
@pi0 pi0 deleted the fix/lazy-css branch October 18, 2022 16:13
@pi0 pi0 mentioned this pull request Oct 18, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
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