fuse-box/fuse-box
View on GitHubMight want to update the docs & code about `before_webindex_write`
Open
#1,922 opened on May 29, 2020
4.0.0enhancementhelp wanted
Description
It exits as an event type, but waitingFor on it, does nothing.
Afaik, I can't see anywhere in the code where its event type would be used.
Might also want to remove the actual type
//fuse.ts
function myCustomWebIndexTransformPlugin(options?: any) {
return async (ctx: Context) => {
ctx.ict.waitFor(
'before_webindex_write',
async (props) => {
console.log("TEST")
console.log(props.bundles[0])
props.fileContents = "REMOVE ALL"
return props;
},
);
};
}
class Builder {
runServer;
getConfig = () =>
fusebox({
target: "browser",
entry: "src/index.tsx",
webIndex: {
template: "src/index.html"
},
plugins: [myCustomWebIndexTransformPlugin()],
cache: true,
devServer: this.runServer,
});
}
const { task } = sparky<Builder>(Builder);
task("default", async ctx => {
ctx.runServer = true;
const fuse = ctx.getConfig();
await fuse.runDev();
});
task("preview", async ctx => {
ctx.runServer = true;
const fuse = ctx.getConfig();
await fuse.runProd({ uglify: false });
});
task("dist", async ctx => {
ctx.runServer = false;
const fuse = ctx.getConfig();
await fuse.runProd({ uglify: false });
});