You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
skipNodeModulesBundle bundles deps it can't resolve (non-node platform + dependency without an exports field) #993
deps.skipNodeModulesBundle is documented as "Skip bundling all node_modules dependencies." But for any dependency published without an exports field (legacy main/types only), it gets bundled anyway whenever platform is not "node". For the dts build this causes an error when the inlined package transitively references a CJS .d.ts.
This issue requires a combination of deps.skipNodeModulesBundle: true+ a non-nodeplatform+ a dependency without an exports field.
What is expected?
deps.skipNodeModulesBundle: true should externalize every bare / non-relative node_modules import, regardless of whether tsdown's resolver can resolve it and regardless of the configured platform.
What is actually happening?
Under a non-node platform, rolldown's resolver does not fall back to the legacy main/types fields, so packages without an exports field don't get resolved. skipNodeModulesBundle only externalizes when that resolve succeeds, so these deps get inlined.
Any additional comments?
The following was generated by Claude:
In DepsPlugin (tsdown/dist/format-*.mjs), externalStrategy only externalizes a node_modules import when the prior this.resolve(...) succeeded:
Under platform: "neutral", resolved is null for a no-exports package, so the function falls through to return false and the dep is bundled.
Workaround
deps.neverBundle feeds rolldown's native external (matched on the specifier, no resolution required), so it externalizes correctly. Note it is tested against both the raw specifier and the resolved absolute path, so internal/absolute paths must be excluded:
Activity
fix(deps): externalize unresolvable bare deps with skipNodeModulesBundle
fix(deps): externalize unresolvable bare deps with skipNodeModulesBundle
sxzz commentedon Jul 21, 2026
skipNodeModulesBundleis deprecated now,deps.neverBundle: truecan fix your case.feat(deps): support `neverBundle: true` to externalize all dependencies