mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
changed build workflow – for auth it's required to have better control over html and assets
This commit is contained in:
33
app/internal/esbuild.entry-output-meta.plugin.ts
Normal file
33
app/internal/esbuild.entry-output-meta.plugin.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import type { Metafile, Plugin } from "esbuild";
|
||||
|
||||
export const entryOutputMeta = (
|
||||
onComplete?: (
|
||||
outputs: {
|
||||
output: string;
|
||||
meta: Metafile["outputs"][string];
|
||||
}[]
|
||||
) => void | Promise<void>
|
||||
): Plugin => ({
|
||||
name: "report-entry-output-plugin",
|
||||
setup(build) {
|
||||
build.initialOptions.metafile = true; // Ensure metafile is enabled
|
||||
|
||||
build.onEnd(async (result) => {
|
||||
console.log("result", result);
|
||||
if (result?.metafile?.outputs) {
|
||||
const entries = build.initialOptions.entryPoints! as string[];
|
||||
|
||||
const outputs = Object.entries(result.metafile.outputs)
|
||||
.filter(([, meta]) => {
|
||||
return meta.entryPoint && entries.includes(meta.entryPoint);
|
||||
})
|
||||
.map(([output, meta]) => ({ output, meta }));
|
||||
if (outputs.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
await onComplete?.(outputs);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user