filter

Pfilter
Bun

Symbol

PluginConstraints.filter

filter: RegExp

Only apply the plugin when the import specifier matches this regular expression

// Only apply the plugin when the import specifier matches the regex
Bun.plugin({
 setup(builder) {
    builder.onLoad({ filter: /node_modules/underscore/ }, (args) => {
     return { contents: "throw new Error('Please use lodash instead of underscore.')" };
    });
 }
})