samccone / bundle-buddy

A tool to understand your bundle size and why files are in your bundle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compatibility issues with latest esbuild version

ppedziwiatr opened this issue · comments

Trying to load metadata file generated with esbuild version 0.15.12 results in an error:
image

This is probably caused by a non compatible metadata file format in the latest versions of the esbuid:
image

(i.e. instead if metadata.inputs should be metadata.metafile.inputs.

As a temp workaround:

const result = await build({
    ...buildConfig,
    outfile: './bundles/web.bundle.min.js',
    metafile: true
  }).catch((e) => {
    console.log(e);
    process.exit(1);
  });

  fs.writeFileSync('metadata.json', JSON.stringify({
    inputs: result.metafile.inputs,
    outputs: result.metafile.outputs
  }));