Skip to content

fix(nuxt-module): register #shopware types in all tsconfig contexts#2488

Merged
Maciek Kucmus (mkucmus) merged 1 commit into
mainfrom
fix/shopware-types-server-context
Jun 15, 2026
Merged

fix(nuxt-module): register #shopware types in all tsconfig contexts#2488
Maciek Kucmus (mkucmus) merged 1 commit into
mainfrom
fix/shopware-types-server-context

Conversation

@mkucmus

Copy link
Copy Markdown
Contributor

Enables part of #2057 (migrate tsconfig.json to the Nuxt 4 reference)

What

@shopware/nuxt-module registered the #shopware ambient type via addTypeTemplate without a context, so it only landed in the app context. Under Nuxt 4's reference-style tsconfig.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 with Cannot find module '#shopware'.

Fix

  • Register the #shopware type in all four contexts (app, server/nitro, node, shared).
  • For projects that ship their own shopware.d.ts, reference it in place so its relative imports keep resolving (instead of copying it into the build dir).
  • Unit tests updated.

Prerequisite for migrating projects to the reference-style tsconfig. It does not address the separate upstream auto-import blocker.

Related

@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontends-starter-template-extended Ready Ready Preview, Comment Jun 15, 2026 9:45am

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts type 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.

@mkucmus Maciek Kucmus (mkucmus) merged commit c56b89e into main Jun 15, 2026
11 checks passed
@mkucmus Maciek Kucmus (mkucmus) deleted the fix/shopware-types-server-context branch June 15, 2026 10:58
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.

3 participants