Description
After upgrading from Astro 6.1.2 to 6.1.3, Netlify deploys fail with a Vite/esbuild error. Builds succeed locally on Windows but fail on Linux (Netlify).
Error
[ERROR] [vite] ✗ Build failed in 90ms
Syntax error "c"
Hint: Browser APIs are not available on the server.
Location: _astro/ContactForm.astro_astro_type_script_index_0_lang.!~{004}~.js:105:153
Root cause
Vite/Rollup uses !~{NNN}~ as internal placeholders for chunk content hashes during the build. In a final pass, these are replaced with actual hashes (e.g. DJeACKAp).
- On Windows (local builds): placeholders resolve correctly. Output file is named
ContactForm.astro_astro_type_script_index_0_lang.DJeACKAp.js.
- On Linux (Netlify): placeholders are not resolved. The file retains
!~{004}~ in its name.
- The
@astrojs/netlify adapter then runs esbuild to bundle the SSR function. esbuild encounters the ! and ~ characters in the filename and fails with Syntax error "c".
- The "Browser APIs are not available on the server" hint is misleading — the actual failure is esbuild choking on special characters in the chunk filename.
- Affects any inline
<script> in Astro components, not just ones with dynamic imports.
Bisection
| Version |
Netlify Deploy |
| 6.0.4 |
✅ Pass |
| 6.0.8 |
✅ Pass |
| 6.1.1 |
✅ Pass |
| 6.1.2 |
✅ Pass |
| 6.1.3 |
❌ Fail |
The regression was introduced in 6.1.3. All tests used @astrojs/netlify@7.0.6.
6.1.3 patches analysis
I initially suspected #16110 (pluginChunkImports), but after reading the source, the plugin returns undefined when assetQueryParams is not set and is filtered out by .filter(Boolean) — it's a no-op for non-Vercel adapters.
The remaining candidates from the 6.1.3 changelog:
Reproduction
- Create an Astro project with
@astrojs/netlify adapter
- Add a component with an inline
<script> tag (e.g. <script>import('canvas-confetti')</script>)
- Deploy to Netlify with
astro@6.1.3
- Build fails with the error above
Downgrading to astro@6.1.2 resolves the issue.
Environment
- Astro: 6.1.3 (fails), 6.1.2 (works)
- @astrojs/netlify: 7.0.6
- Node: 22.x (tested with both 22.18.0 and 22.22.2 — same result)
- Local OS: Windows 10 (builds succeed)
- Deploy OS: Linux (Netlify, builds fail)
Same bug reproduces across two separate sites with the same stack.
Description
After upgrading from Astro 6.1.2 to 6.1.3, Netlify deploys fail with a Vite/esbuild error. Builds succeed locally on Windows but fail on Linux (Netlify).
Error
Root cause
Vite/Rollup uses
!~{NNN}~as internal placeholders for chunk content hashes during the build. In a final pass, these are replaced with actual hashes (e.g.DJeACKAp).ContactForm.astro_astro_type_script_index_0_lang.DJeACKAp.js.!~{004}~in its name.@astrojs/netlifyadapter then runs esbuild to bundle the SSR function. esbuild encounters the!and~characters in the filename and fails withSyntax error "c".<script>in Astro components, not just ones with dynamic imports.Bisection
The regression was introduced in 6.1.3. All tests used
@astrojs/netlify@7.0.6.6.1.3 patches analysis
I initially suspected #16110 (
pluginChunkImports), but after reading the source, the plugin returnsundefinedwhenassetQueryParamsis not set and is filtered out by.filter(Boolean)— it's a no-op for non-Vercel adapters.The remaining candidates from the 6.1.3 changelog:
isHTMLStringcheck failing in multi-realm environments #16142 — MDX/AstroContainer HTML escapingReproduction
@astrojs/netlifyadapter<script>tag (e.g.<script>import('canvas-confetti')</script>)astro@6.1.3Downgrading to
astro@6.1.2resolves the issue.Environment
Same bug reproduces across two separate sites with the same stack.