bun-plugin-screeps
Version:
Bun build plugin + CLI to upload JS/WASM bundles to the Screeps API
19 lines (18 loc) • 634 B
JavaScript
export function screepsPlugin() {
return {
name: "screeps-build-only",
setup(builder) {
builder.onResolve({ filter: /\.map$/ }, ({ path }) => ({ path }));
builder.onLoad({ filter: /\.map$/ }, async ({ path }) => {
const raw = await Bun.file(path).text();
const json = JSON.parse(raw);
delete json.sourcesContent;
const contents = "module.exports = " + JSON.stringify(json) + ";\n";
return {
loader: "js",
contents,
};
});
},
};
}