CloudCannon / bookshop

📚 A component development workflow for static websites.
MIT License
247 stars 21 forks source link

fix(astro-engine): Define ENV_BOOKSHOP_LIVE in typescript files #202

Open oliverlynch opened 4 days ago

oliverlynch commented 4 days ago

As mentioned in #201 - My builds no longer work after moving functions with dynamic imports guarded by !ENV_BOOKSHOP_LIVE. This patch allows my site to build correctly, both locally and on Cloudcannon.

This is a much larger change than my last PR and has the possibility to cause side effects for other astro sites... and I haven't tested this beyond a site build on my local machine and on Cloudcannon.

It may be possible to get ENV_BOOKSHOP_LIVE to work in ts files with a smaller code change, just with the esbuild.transform. If that is preferable I can revise the PR with only that change.