-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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 ourterms of serviceand privacy statement.We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow to specify app id when creating a nuxt app #28392
Conversation
Run & review this pull request inStackBlitz Codeflow. |
packages/nuxt/src/app/nuxt.ts
Outdated
/** | ||
* The name of the Nuxt application, overrides the default name specified in the Nuxt config (default: `nuxt-app`). | ||
*/ | ||
appId?: NuxtApp['_name'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Would it make sense for this to bename
instead ofappId
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I was unsure about this as well. In the nuxt config it is appId, but name would be a natural choice as well. Do you have a preference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Let's useid
- and update_name
to be_id
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I agree, this makes sense!
However, there was already an_id
field in theNuxtApp
,which was used to generate app-wide unique ids inuseId
.I've renamed that field to_genId
.
@danielroe@huang-julienI've tried to use this PR in the storybook module but encountered the following error:
when calling The reason is that I do set the context via How is (I can open a new issue for these questions, but thought this PR has the required context.) |
<!-- ☝️ PR title should follow conventional commits (https://conventionalcommits.org). In particular, the title should start with one of the following types: - docs: 📖 Documentation (updates to the documentation or readme) - fix: 🐞 Bug fix (a non-breaking change that fixes an issue) - feat: ✨ New feature/enhancement (a non-breaking change that adds functionality or improves existing one) - feat!/fix!:⚠️ Breaking change (fix or feature that would cause existing functionality to change) - chore: 🧹 Chore (updates to the build process or auxiliary tools and libraries) --> ### 🔗 Linked issue This finallyfixes#661. <!-- If it resolves an open issue, please link the issue here. For example "Resolves#123"--> ### 📚 Description Withnuxt/nuxt#28392it is now possible to key the context to the correct nuxt instance. Breaking change since we need the newest nuxt version for this to work. <!-- Describe your changes in detail --> <!-- Why is this change required? What problem does it solve? -->
@tobiasdiezYes, multi-app support hasn't yet landed. The next step would be a compile time injection of the nuxt app-id in calls to If you are able to add some tests we can add it tohttps://github /nuxt/ecosystem-ci/so we ensure any future changes along these lines don't break the storybook integration. 🙏 |
Thanks for the feedback! I really like the multi-app feature and the possibilities it opens. Big thanks to everyone that worked on it so far!
Sure!nuxt/ecosystem-ci#14 |
🔗 Linked issue
📚 Description
When creating a new nuxt application via
createNuxtApp
,it is now possible to overwrite the app id specified in the nuxt config.This is needed for the storybook module where we create multiple instances of the same nuxt app (in the same website) and would like to give them different ids to preserve their context. Seenuxt-modules/storybook#723 (comment)for more context that triggered this PR.