Fix esbuild vendor bundle error by marking chart.js as external
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 <noreply@anthropic.com>
This commit is contained in:
parent
74767345fd
commit
c932abb434
1 changed files with 1 additions and 1 deletions
|
|
@ -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__)}
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue