Closed uwaovo closed 1 year ago
The issue is that vite-plugin-cesium
uses transformIndexHtml to link the build output of Cesium global runtime. Astro doesn't run the transformIndexHtml
hook as it doesn't work for us, and it only applies to Vite-handled HTML pages.
As a workaround, you can add that script yourself by placing this in the <head>
of Layout.astro
:
{import.meta.env.PROD && <script src={`${import.meta.env.BASE_URL}cesium/Cesium.js`}></script>}
As this isn't something Astro supports by default, I'll close this as expected behaviour.
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
astro dev runs normally, but when I use build and then preview, I encounter an error: Uncaught (in promise) ReferenceError: Cesium is not defined. In _astro js:
What's the expected result?
show as in astro dev.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-9z3dkb
Participation