Change8

@sveltejs/kit@3.0.0-next.9

Breaking Changes
📦 sveltekitView on GitHub →
5 breaking🐛 4 fixes1 deprecations🔧 7 symbols

Summary

This release introduces several breaking changes including alias updates and stricter form submission rules. It also includes performance improvements and bug fixes for client-side bundling and CSRF protection.

⚠️ Breaking Changes

  • `handle`'s `resolve` is now typed to always return a `Promise`. Update any code that expects `resolve` to return a non-Promise value.
  • The `$lib` alias has been replaced with `#lib`. Update all import paths that use `$lib` to use `#lib` instead. The `files.lib` configuration option has been removed.
  • Cross-origin form submissions are now disallowed without a `Content-Type` header. Ensure all cross-origin form submissions include a `Content-Type` header.
  • Server-only directories (e.g., `/server/` in the path) are now treated as server-only everywhere within the project, except for `src/routes` and the assets directory. Ensure your project structure adheres to this new rule.
  • CORS handling for static directory requests during development is now delegated to Vite. This may affect how CORS is handled for static assets in development environments.

Migration Steps

  1. Replace all instances of the `$lib` alias with `#lib` in import paths.
  2. Remove the `files.lib` configuration option from your project.
  3. Ensure all cross-origin form submissions include a `Content-Type` header.
  4. Update import paths for environment variables and application environment to use `$app/env/private`, `$app/env/public`, and `$app/env` instead of the deprecated aliases.

🐛 Bug Fixes

  • Cached the default cookie header parse to avoid allocations in `cookies.get`.
  • Prevented client-side code from being bundled by Cloudflare Wrangler.
  • Handled rejected streamed server data after delayed loads.
  • Enabled CSRF protection in builds with a non-production `NODE_ENV` value.

Affected Symbols

⚡ Deprecations

  • `$env/static/private`, `$env/dynamic/private`, `$env/static/public`, `$env/dynamic/public`, and `$app/environment` are now deprecated aliases for `$app/env/private`, `$app/env/public`, and `$app/env` respectively. Update to the new paths to avoid future removal.