Skip to content

Commit

Permalink
feat(ci): Export meta.json from esbuild
Browse files Browse the repository at this point in the history
Ability to use esbuild Bundle Size Analyzer to breakdown components in bundle. This will be included in GitHub Releases
https://esbuild.github.io/analyze/
  • Loading branch information
andymac4182 committed Apr 14, 2023
1 parent ffeea5c commit c27ca7d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion esbuild.config.mjs
@@ -1,6 +1,8 @@
import esbuild from "esbuild";
import process from "process";
import builtins from 'builtin-modules'
import { writeFileSync } from 'fs';


const banner =
`/*
Expand Down Expand Up @@ -91,10 +93,12 @@ const buildConfig = {
mainFields: ['module', 'main'],
plugins: [mermaid_renderer_plugin],
minify: true,
metafile: true,
};

if (prod) {
await esbuild.build(buildConfig);
const buildResult = await esbuild.build(buildConfig);
writeFileSync("./dist/meta.json", JSON.stringify(buildResult.metafile));
} else {
const context = await esbuild.context(buildConfig);
await context.watch();
Expand Down

0 comments on commit c27ca7d

Please sign in to comment.