What problem does this feature solve?
Currently, all dependencies are bundled by default. However, some packages break when they are bundled in Node.js applications. For example, Sentry and OpenTelemetry auto-instrumentation rely on being loaded as external dependencies and will not function correctly if bundled.
To address this, we need an option to automatically externalize dependencies instead of bundling them.
What does the proposed API look like?
Introduce an option similar to Rslib’s autoExternal, which automatically marks dependencies as external and excludes them from the bundle.
This would allow developers to build Node.js applications without unintentionally breaking packages that require being externalized.