Closed
Description
In the mock plugin below, I expected onLoad's args.suffix
to match what was returned from onResolve, but it's only there if path
is also included in the onResolve results.
I have no experience with bundler plugins though and so assume this is working as expected and that I'm just missing some common knowledge, but it may be nice if the docs noted the path requirement. ✌️
import * as path from "path";
export const test = (options = {}) => ({
name: "test",
setup(build) {
build.onResolve({ filter: /\.svg$/ }, async (args) => {
if (!args.suffix) {
return {
suffix: "?my-suffix"
// path: path.join(args.resolveDir, args.path), // suffix is only set if path included
};
}
});
build.onLoad({ filter: /\.svg$/ }, async (args) => {
console.log("test suffix", args.suffix); // suffix is "" unless path is included in onResolve
});
},
});
Metadata
Assignees
Labels
No labels
Activity