Skip to content

Astro 6.1.3: Vite chunk hash placeholders unresolved on Linux, breaking Netlify SSR builds #16209

@scalebloom

Description

@scalebloom

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

  1. Create an Astro project with @astrojs/netlify adapter
  2. Add a component with an inline <script> tag (e.g. <script>import('canvas-confetti')</script>)
  3. Deploy to Netlify with astro@6.1.3
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIssue needs to be triaged

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions