What problem does this feature solve?
When using esmExternalRequirePlugin, people might accidentally forget to remove the dependency from the top-level external options, the plugin won't work. Example:
import { defineConfig } from "rolldown";
import { esmExternalRequirePlugin } from "rolldown/experimental";
export default defineConfig({
input: "src/index.js",
external: ["react"],
plugins: [
esmExternalRequirePlugin({
external: ["react"],
}),
],
});
Related: #6022 (comment)
What does the proposed API look like?
Just throw an error (or warn) in that case, inform the user about the miscommunication.