Skip to content

fix: support type: module in server build output - #1701

Merged
danielroe merged 1 commit into
mainfrom
feat/type-module
Jan 12, 2026
Merged

danielroe merged 1 commit into
mainfrom
feat/type-module

Conversation

@wattanx

@wattanx wattanx commented Jan 12, 2026

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Fixes: #1144

❓ 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

When a project has "type": "module" in its root package.json, Node.js treats all .js files as ES modules by default. This causes issues with the server build output, which expects CommonJS semantics.

This PR adds a package.json file with { "type": "commonjs" } to the dist/server directory during the build process. This ensures that .js files in the server build directory are correctly interpreted as CommonJS modules, regardless of the project's root package.json configuration.

📝 Checklist

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

@pkg-pr-new

pkg-pr-new Bot commented Jan 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/bridge@1701
npm i https://pkg.pr.new/@nuxt/bridge-schema@1701

commit: 601e727

@wattanx
wattanx marked this pull request as ready for review January 12, 2026 12:56
@wattanx
wattanx requested a review from danielroe January 12, 2026 12:56
@danielroe
danielroe merged commit 9a26e7f into main Jan 12, 2026
77 of 78 checks passed
@danielroe
danielroe deleted the feat/type-module branch January 12, 2026 13:02
@github-actions github-actions Bot mentioned this pull request Jan 12, 2026
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.

Support for Nitro/ESM Build

2 participants