Fix server-side bundling to not use the "module" export condition
The "module" export condition is intended for browser bundlers (like
Rollup/Vite) that support ESM tree-shaking. It must NOT be applied to
server-side bundling because server code may re-export to CommonJS
consumers or has different module semantics.
- Webpack: override `byDependency.esm.conditionNames` for the node
server to explicitly exclude "module". Using '...' would still expand
to byDependency.esm defaults which include "module", so an explicit
list ['import', 'webpack', 'production'/'development', 'node'] is used.
- Turbopack: set `module: false` in `get_server_resolve_options_context`.
The field was incorrectly set to `true` for all server contexts.
Adds a test fixture and e2e test to prevent regressions.
Co-Authored-By:
Claude <noreply@anthropic.com>
Showing
Please
register
or
sign in
to comment