aboutsummaryrefslogtreecommitdiffhomepage
path: root/esbuild.mjs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-12-05 04:08:22 +0900
committernsfisis <nsfisis@gmail.com>2025-12-05 04:08:22 +0900
commitfbd4f2129ce8fe106391302896dd86e05b2f331b (patch)
tree3be97d86c89a4a8a497e1b8a2d7d032eb153438e /esbuild.mjs
parentca3f1c4b0bd08ab6e836923601cf699d1fd894fb (diff)
downloadphperkaigi-2024-albatross-archive-fbd4f2129ce8fe106391302896dd86e05b2f331b.tar.gz
phperkaigi-2024-albatross-archive-fbd4f2129ce8fe106391302896dd86e05b2f331b.tar.zst
phperkaigi-2024-albatross-archive-fbd4f2129ce8fe106391302896dd86e05b2f331b.zip
add files
Diffstat (limited to 'esbuild.mjs')
-rw-r--r--esbuild.mjs22
1 files changed, 22 insertions, 0 deletions
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),
+ },
+});