Commit ca007b3
fix(website): prefix astrochart.js path with BASE_URL (#112)
* CI: fix docs-deploy Node version for Astro build
The deploy workflow ran the library build (webpack, Node 20) and the
Astro website build in the same job under node-version 20, causing
Astro to fail with "Node.js v20 is not supported".
A single job can only run one Node version, so split the build job:
- build-library (Node 20): builds the webpack bundle and uploads it
as a GitHub Actions artifact
- build-website (Node 22): downloads the bundle, copies it into
website/public/, installs website deps, builds the Astro site, and
uploads the Pages artifact
- deploy: now depends on build-website (unchanged otherwise)
🤖 Generated with [eca](https://eca.dev)
Co-Authored-By: eca <git@eca.dev>
* fix(website): prefix astrochart.js path with BASE_URL
The bundle was hard-coded as '/astrochart.js' (root-relative) in
ChartDemo.astro. With base: '/AstroChart' in astro.config.mjs the
file is deployed at /AstroChart/astrochart.js, so the browser was
requesting the wrong path and getting a 404.
Pass import.meta.env.BASE_URL into the is:inline script via
define:vars and prefix both the querySelector guard and the dynamic
script.src with it. Astro guarantees BASE_URL ends with '/', so
concatenating 'astrochart.js' produces the correct path.
🤖 Generated with [eca](https://eca.dev)
Co-Authored-By: eca <git@eca.dev>
---------
Co-authored-by: eca <git@eca.dev>1 parent e7f30e6 commit ca007b3
1 file changed
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
115 | | - | |
| 116 | + | |
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| |||
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
125 | | - | |
| 126 | + | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
| |||
0 commit comments