From c932abb43458ce68c2971ca4106a1c6a98d75fbc Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Mon, 21 Jul 2025 10:11:26 -0500 Subject: [PATCH] Fix esbuild vendor bundle error by marking chart.js as external MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Docker build was failing because the Chart.js date adapter was trying to require("chart.js") but esbuild couldn't resolve it since Chart.js is loaded as a UMD file, not a CommonJS module. Added --external:chart.js to the vendor esbuild configuration to tell esbuild not to try bundling chart.js when it encounters require("chart.js") in the date adapter. This is correct because Chart.js is already loaded globally from the UMD file. This fixes the "Could not resolve 'chart.js'" error during production builds. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- config/config.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.exs b/config/config.exs index 072bed4..163bd61 100644 --- a/config/config.exs +++ b/config/config.exs @@ -87,7 +87,7 @@ config :esbuild, env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)} ], vendor: [ - args: ~w(js/vendor.js --bundle --target=es2017 --outdir=../priv/static/assets --minify), + args: ~w(js/vendor.js --bundle --target=es2017 --outdir=../priv/static/assets --external:chart.js --minify), cd: Path.expand("../assets", __DIR__), env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)} ]