aprs.me/assets
Graham McIntire 493805706f
Fix Chart.js adapter dynamic require error with CommonJS shim
Fixed "Dynamic require of 'chart.js' is not supported" error that occurred
when the Chart.js date adapter tried to use require() in the browser.

The issue was caused by marking chart.js as external in esbuild, which
prevented the bundler from resolving the require() call. The date adapter
uses UMD format and expects to find Chart.js via require() in CommonJS
environments.

Solution:
- Added a temporary window.require shim before loading the date adapter
- The shim returns window.Chart when require('chart.js') is called
- Cleaned up the shim after the adapter loads to avoid polluting globals
- This allows the adapter to find Chart.js and register itself properly

The weather charts now load without errors in both development and production.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-21 10:21:32 -05:00
..
css Bundle all vendor JavaScript files locally instead of loading from CDNs 2025-07-21 09:52:39 -05:00
js Fix Chart.js adapter dynamic require error with CommonJS shim 2025-07-21 10:21:32 -05:00
vendor Bundle all vendor JavaScript files locally instead of loading from CDNs 2025-07-21 09:52:39 -05:00
download-vendor-files.sh Bundle all vendor JavaScript files locally instead of loading from CDNs 2025-07-21 09:52:39 -05:00