Added esbuild bundle inspection metafile

This commit is contained in:
Dan Brown 2023-02-17 22:37:13 +00:00
parent f51036b203
commit c148e2f3d9
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
2 changed files with 7 additions and 1 deletions

4
.gitignore vendored
View file

@ -21,8 +21,10 @@ yarn.lock
nbproject
.buildpath
.project
.nvmrc
.settings/
webpack-stats.json
.phpunit.result.cache
.DS_Store
phpstan.neon
phpstan.neon
esbuild-meta.json

View file

@ -2,6 +2,7 @@
const esbuild = require('esbuild');
const path = require('path');
const fs = require('fs');
// Check if we're building for production
// (Set via passing `production` as first argument)
@ -19,6 +20,7 @@ const outdir = path.join(__dirname, '../../public/dist');
// Build via esbuild
esbuild.build({
bundle: true,
metafile: true,
entryPoints,
outdir,
sourcemap: true,
@ -27,4 +29,6 @@ esbuild.build({
format: 'esm',
minify: isProd,
logLevel: "info",
}).then(result => {
fs.writeFileSync('esbuild-meta.json', JSON.stringify(result.metafile));
}).catch(() => process.exit(1));