method
bun.PluginBuilder.onLoad
): this;
Register a callback to load imports with a specific import specifier
@param constraints
The constraints to apply the plugin to
@param callback
The callback to handle the import
@returns
this for method chaining
Bun.plugin({
setup(builder) {
builder.onLoad({ filter: /^hello:world$/ }, (args) => {
return { exports: { foo: "bar" }, loader: "object" };
});
},
});