From fbd4f2129ce8fe106391302896dd86e05b2f331b Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 5 Dec 2025 04:08:22 +0900 Subject: add files --- esbuild.mjs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 esbuild.mjs (limited to 'esbuild.mjs') diff --git a/esbuild.mjs b/esbuild.mjs new file mode 100644 index 0000000..0e93539 --- /dev/null +++ b/esbuild.mjs @@ -0,0 +1,22 @@ +import { build } from 'esbuild' + +let ALBATROSS_BASE_PATH = process.env.ALBATROSS_BASE_PATH; +if (ALBATROSS_BASE_PATH == null) { + throw new Error('$ALBATROSS_BASE_PATH is not set'); +} +// WORKAROUND: +// Unquote the value as work-around for Docker and Docker Compose. +// How Docker parses .env files is different from how Docker Compose does for some reason. +// Docker treats the value as is, while Docker Compose strips the outermost quotes. +ALBATROSS_BASE_PATH = ALBATROSS_BASE_PATH.replace(/^"(.*)"$/, '$1'); + +await build({ + entryPoints: ['assets/index.js', 'assets/chart.js', 'assets/loading.js'], + outdir: 'public/assets', + bundle: true, + minify: true, + sourcemap: true, + define: { + 'process.env.ALBATROSS_BASE_PATH': JSON.stringify(ALBATROSS_BASE_PATH), + }, +}); -- cgit v1.2.3-70-g09d2