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 nbproject
.buildpath .buildpath
.project .project
.nvmrc
.settings/ .settings/
webpack-stats.json webpack-stats.json
.phpunit.result.cache .phpunit.result.cache
.DS_Store .DS_Store
phpstan.neon phpstan.neon
esbuild-meta.json

View file

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