Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nuxt): pass nuxt runtimeConfig into nuxt app stub (fix #494) #567

Merged
merged 3 commits into from
Aug 13, 2023

Conversation

epr3
Copy link
Contributor

@epr3 epr3 commented Jul 31, 2023

Description

Fixes #494

I've made the setupNuxtApp function to accept the current Nuxt instance's public runtime config that is returned from loadNuxt and also passed in that value into setupCode in an 'eval' like fashion through JSON.stringify.

Additional context

This should address the issue at hand, but may also fix compatibility issues with other Nuxt modules which may populate the public runtime config as part of their initialisation such as @storyblok/nuxt (I've encountered this issue on another project while attempting to integrate Histoire).

Relevant line: https://github.com/storyblok/storyblok-nuxt/blob/8874551fa331c72921cd4a8279c67089311c5750/src/module.ts#L57


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • If it's a new feature, provide a convincing reason to add it. Ideally, you should open a suggestion issue first and have it approved before working on it.
  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@codesandbox
Copy link

codesandbox bot commented Jul 31, 2023

This branch is running in CodeSandbox. Use the links below to review this PR faster.


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

@stackblitz
Copy link

stackblitz bot commented Jul 31, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@netlify
Copy link

netlify bot commented Jul 31, 2023

Deploy Preview for histoire-examples-svelte3 ready!

Name Link
🔨 Latest commit bf26b69
🔍 Latest deploy log https://app.netlify.com/sites/histoire-examples-svelte3/deploys/64d8f91845eb2a0008fda880
😎 Deploy Preview https://deploy-preview-567--histoire-examples-svelte3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Jul 31, 2023

Deploy Preview for histoire-examples-vue3 ready!

Name Link
🔨 Latest commit bf26b69
🔍 Latest deploy log https://app.netlify.com/sites/histoire-examples-vue3/deploys/64d8f9175059d50008edd182
😎 Deploy Preview https://deploy-preview-567--histoire-examples-vue3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Jul 31, 2023

Deploy Preview for histoire-controls ready!

Name Link
🔨 Latest commit bf26b69
🔍 Latest deploy log https://app.netlify.com/sites/histoire-controls/deploys/64d8f917cba11d00086bc46b
😎 Deploy Preview https://deploy-preview-567--histoire-controls.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Jul 31, 2023

Deploy Preview for histoire-site ready!

Name Link
🔨 Latest commit bf26b69
🔍 Latest deploy log https://app.netlify.com/sites/histoire-site/deploys/64d8f91780e3600007c002e2
😎 Deploy Preview https://deploy-preview-567--histoire-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@epr3 epr3 changed the title fix: plugin-nuxt does not resolve runtimeConfig values #494 fix: plugin-nuxt does not resolve runtimeConfig values (fix #494) Jul 31, 2023
@epr3 epr3 changed the title fix: plugin-nuxt does not resolve runtimeConfig values (fix #494) fix: pass nuxt runtimeConfig into nuxt app stub (fix #494) Jul 31, 2023
@Akryum Akryum changed the title fix: pass nuxt runtimeConfig into nuxt app stub (fix #494) fix(nuxt): pass nuxt runtimeConfig into nuxt app stub (fix #494) Aug 13, 2023
@Akryum Akryum merged commit 284e0fe into histoire-dev:main Aug 13, 2023
@awacode21
Copy link

How can i use that fix for my histoire, so that it has access to my nuxt runtime config? @Akryum could not find anything in documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plugin-nuxt does not resolve runtimeConfig values
3 participants