fix(nuxt-module): register #shopware types in all tsconfig contexts#2488
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates @shopware/nuxt-module to ensure the #shopware ambient type declaration is available in all Nuxt 4 project-reference TypeScript contexts (nuxt/app, nitro/server, node, shared), preventing server/shared builds from failing with Cannot find module '#shopware'.
Changes:
- Register the
shopware.d.tstype template in all four Nuxt type-check contexts instead of only the app context. - If a project provides its own
shopware.d.ts, generate a type template that references the project file in place (preserving relative import resolution). - Update unit tests and add a changeset for the patch release.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/nuxt-module/src/index.ts | Registers shopware.d.ts across all Nuxt TS contexts and references project-local shopware.d.ts when present. |
| packages/nuxt-module/src/index.test.ts | Updates tests to assert context-aware registration and in-place referencing behavior. |
| .changeset/gentle-otters-cheer.md | Adds a patch changeset documenting the multi-context type registration fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Patryk Tomczyk (patzick)
approved these changes
Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables part of #2057 (migrate
tsconfig.jsonto the Nuxt 4 reference)What
@shopware/nuxt-moduleregistered the#shopwareambient type viaaddTypeTemplatewithout a context, so it only landed in the app context. Under Nuxt 4's reference-styletsconfig.json(project references), the server/shared/node contexts are type-checked as separate projects, so server code importing#shopware(e.g.server/apiBuilder.ts,server/routes/**) failed withCannot find module '#shopware'.Fix
#shopwaretype in all four contexts (app, server/nitro, node, shared).shopware.d.ts, reference it in place so its relative imports keep resolving (instead of copying it into the build dir).Related
nuxi typecheckfails to resolve ambient type declarations inserver/types/nuxt/nuxt#34385 (ambient type declarations not resolved per-context)nuxt typecheckraise error with auto-imported vue/nuxt utils (ref, useState, ...) nuxt/nuxt#34212 (auto-imports unresolved under build-mode typecheck)