Skip to content

fix(build): add empty loader for .node files in esbuild#1120

Open
clichedmoog wants to merge 1 commit intoopennextjs:mainfrom
clichedmoog:feat/esbuild-node-loader
Open

fix(build): add empty loader for .node files in esbuild#1120
clichedmoog wants to merge 1 commit intoopennextjs:mainfrom
clichedmoog:feat/esbuild-node-loader

Conversation

@clichedmoog
Copy link
Copy Markdown
Contributor

@clichedmoog clichedmoog commented Feb 19, 2026

Motivation

When a project has native binary dependencies (e.g. @swc/core, Prisma), esbuild can encounter .node files during bundling and crash with:

No loader is configured for ".node" files

This was split from #1117 per review feedback.

The root cause is that esbuild resolves package imports (e.g. @swc/core-darwin-arm64) through package.json main fields, which can point to .node native binaries. Since esbuild has no built-in handler for this format, it fails.

Changes

Added loader: { ".node": "empty" } to both esbuildSync and esbuildAsync in helper.ts, so esbuild produces an empty module instead of crashing.

Related issues

Prevents esbuild from crashing with "No loader is configured for .node
files" when native binary imports are encountered during bundling.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 19, 2026

🦋 Changeset detected

Latest commit: 9fcc4fd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@opennextjs/aws Patch
app-pages-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 21, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/aws@1120

commit: 9fcc4fd

Copy link
Copy Markdown
Contributor

@conico974 conico974 left a comment

Choose a reason for hiding this comment

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

Not the right change as previously said in #1117 (review)

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.

2 participants