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

feat(kit): useNitro() utility - #7557

Merged
pi0 merged 8 commits into
mainfrom
feat/kit-use-nitro
Sep 15, 2022
Merged

feat(kit): useNitro() utility#7557
pi0 merged 8 commits into
mainfrom
feat/kit-use-nitro

Conversation

@pi0

@pi0pi0 commented Sep 15, 2022

Copy link
Copy Markdown
Member

🔗 Linked issue

❓ 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

Taling with @danielroe, it is sometimes required to access nitro instance mainly to access resolved configuration. But it is tricky because nitro is intentionally initialized after all modules to reflect configuration changes by them.

This PR exposes useNitro() to be used within or after ready hook:

Note: Users should not modify the nitro configuration using this instance either. Because we have more than once instance (one is used for prerendering) and also nitro does not reflects configuration changes always after initializing. It is a read-only instance.

import{useNitro}from'@nuxt/kit'nuxt.hook('ready',()=>{console.log(useNitro())})

📝 Checklist

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

@pi0
pi0 requested a review from danielroeSeptember 15, 2022 12:43
@netlify

netlifyBot commented Sep 15, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

NameLink
🔨 Latest commitff5fbc3
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/6323215b8f6e9d000998871d

Comment threadpackages/kit/src/nitro.ts
Comment threadpackages/schema/src/types/nuxt.ts Outdated
@pi0
pi0 merged commit b933015 into mainSep 15, 2022
@pi0
pi0 deleted the feat/kit-use-nitro branch September 15, 2022 16:10
@pi0pi0 mentioned this pull request Sep 15, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@pi0@danielroe