ConstRolldown does not recommend marking packages as external in library builds. Doing so shifts the module resolution responsibility to the consumer. Use this plugin only when the legacy library is guaranteed to be available in the target environment.
A Vite Plugin instance.
Vite plugin that marks legacy libraries as external, preventing Rolldown from bundling them and causing CommonJS interop errors at runtime.
The plugin hooks into the
resolveIdphase withenforce: 'pre'and marks any import whose path starts with<lib>/as external. Rolldown then skips those imports entirely, leaving them as bare import statements in the output.