-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Astro 3.0 breaking changes tracker #3756
Comments
Removed support for Node 16In Astro v2.x, Node 16 was supported. Astro v3.0 it's not the case anymore, the lowest supported version is now What should I do?https://docs.astro.build/en/guides/upgrade-to/v2/ has a section for when we dropped Node 14, so it'll be pretty much the same thing. This page also has a mention of the supported version: https://docs.astro.build/en/install/auto/ If a technical reason is wanted, Node 16 is getting deprecated in September, so not too long after Astro 3.0 releases. Additionally |
Deprecated lowercase function endpointsIn Astro v2.x, endpoints are defined using lowercase function names: Astro v3.0 deprecates them in favour of uppercase function names. What should I do?Update the names as follow:
|
Removed automatic flattening of
|
Changed internal MDX and JSX plugins sorting responsibilityIn Astro v2.x, Astro core would sort the MDX plugin before the JSX plugin to transform code correctly. Astro v3.0 now lets the MDX integration ( What should I do?Update (PR: withastro/astro#7872) |
[changed/removed/added/deprecated] feature/name/title/descriptionIn Astro v2.x, Astro v3.0 What should I do?With TypeScript you will need to use the ---
if(Astro.cookies.has(id)) {
const id = Astro.cookies.get(id)!;
}
--- If you could also skip ---
const id = Astro.cookies.get(id)!;
if(id) {
// TypeScript knows id is an AstroCookie
}
--- |
Changed default image service to Sharp instead of SquooshIn Astro v2.x, Squoosh was the default image service Astro v3.0, Sharp is now the default image service What should I do?For 99.999% of people, nothing! This change is invisible. However, if you still need the Squoosh service for some reason, you can use it like this: import { defineConfig, squooshImageService } from "astro/config";
// https://astro.build/config
export default defineConfig({
image: {
service: squooshImageService(),
}
}) But be warned that it will highly probably be removed in the future. |
Changed internal MDX custom components export handling responsibilityIn Astro v2.x, the Astro v3.0 moves this responsibility back to the MDX integration to handle it itself. What should I do?Update (PR: withastro/astro#7904) |
Removed
|
changed the default value of
|
changed - default port usedIn Astro v2.x, Astro ran on port 3000 by default Astro v3.0 changes the default port to 4321 🚀 What should I do?Update any references to (Discord user reported this as a breaking change: https://discord.com/channels/830184174198718474/830184175176122389/1136797603393183775 ) |
Removed
|
Changed import.meta.env.BASE_URL default trailingSlash behaviourIn Astro v2.x, Astro v3.0 What should I do?If your If your // astro.config.mjs
- base: 'my-base',
+ base: 'my-base/', (PR: withastro/astro#7878) |
deprecated
|
Changed tsconfig.json presetsIn Astro v2.x, the tsconfig.json presets include support for both TypeScript 4.x and 5.x. Astro v3.0 updates the tsconfig.json presets to only support TypeScript 5.x. What should I do?Update your TypeScript version to at least v5.0. npm install typescript@latest --save-dev (PR: withastro/astro#7785) |
Added simple asset support for Cloudflare, Deno, Vercel Edge and Netlify EdgeIn Astro v2.x, using the assets feature in Cloudflare, Deno, Vercel Edge and Netlify Edge errors in runtime as the environments do not support Astro's builtin Squoosh and Sharp image optimization. Astro v3.0 allows these environments to work without errors, but does not perform any image transformation and processing. However, you would still get benefits, e.g. no Cumulative Layout Shift (CLS), enforced What should I do?If you previously avoided the assets feature due these constraints, you can now use them without issues. You can also use the no-op image service to explicitly opt-in to this behaviour: // astro.config.mjs
export default {
image: {
service: {
entrypoint: 'astro/assets/services/noop'
}
}
} (PR: withastro/astro#7903) |
Changed the default value of
|
Changed Multiple JSX framework configurationIn Astro v2.x, you could use multiple JSX framework integrations (React, Solid, Preact) in the same project and Astro without having to identify which files belonged to which framework. Astro v3.0, in order to better support single-framework usage, now requires that you specify which files are included in each integrations config. This change is only needed if using more than one of these frameworks; otherwise no configuration is needed. What should I do?When using multiple JSX frameworks in the same project, use the import { defineConfig } from 'astro/config';
import preact from '@astrojs/preact';
import react from '@astrojs/react';
import svelte from '@astrojs/svelte';
import vue from '@astrojs/vue';
import solid from '@astrojs/solid-js';
export default defineConfig({
// Enable many frameworks to support all different kinds of components.
integrations: [
preact({ include: ['**/preact/*'] }),
solid({ include: ['**/solid/*'] }),
react({ include: ['**/react/*'] }),
],
}); |
Removed kebab-case transform for camelCase CSS variablesIn Astro v2.x, camelCase CSS variables passed to the Astro v3.0 removes the kebab-case transform, and only the original camelCase CSS variable is rendered. ---
const myValue = "red"
---
<!-- input -->
<div style={{ "--myValue": myValue }}></div>
<!-- output (before) -->
<div style="--my-value:var(--myValue);--myValue:red"></div>
<!-- output (after) -->
<div style="--myValue:red"></div> What should I do?If you were relying on the kebab-case transform in your styles, make sure to use the camelCase version to prevent missing styles. For example: <style>
div {
- color: var(--my-value);
+ color: var(--myValue);
}
</style> (PR: withastro/astro#8019) |
Changed entrypoint export pathsIn Astro v2.x, you can import internal Astro APIs from Astro v3.0 removes the two entrypoints in favour of the existing What should I do?These are entrypoints for Astro's internal API and should not affect your project, but if you do use these entrypoints, you can migrate like below: - import 'astro/internal/index.js';
+ import 'astro/runtime/server/index.js';
- import 'astro/server/index.js';
+ import 'astro/runtime/server/index.js'; (PR: withastro/astro#8085) |
Changed Astro Island serialization approachThis PR did not make the cut, we'll be revisiting it after launch! (PR: withastro/astro#8004) Original ChangelogChanged Astro Island serialization approachIn Astro v2.x, Astro serialized props passed to Astro Islands as JSON embedded in an HTML attribute. What should I do?This update should not change any user-facing behavior, but developer-facing tools that inspect Astro Islands may need to be updated to support this new output format. - <astro-island props="{\"value\":\"Hello world!\"}">
+ <astro-island>
+ <script async>Astro.assign(document.currentScript,{props:{value:"Hello world!"}})</script>
<h1>Hello world!</h1>
</astro-island> |
Small stylesheets now get inlined by defaultIn Astro v2.x, all project stylesheets were sent as tags by default, and you could opt-in to inlining them by using the What should I do?Nothing, this change does not require any migration. To go back to the old behavior, configure export default defineConfig({
build: {
+ inlineStylesheets: "never"
}
}) (PR: withastro/astro#8118) |
Changed implementation of
|
Changed behavior of
|
(Sarah's placeholder entry) Unexperimenalized:
|
Changed astro package entrypoint exportsIn Astro v2.x, the Astro v3.0 removes the CLI from the entrypoint, and exports a new set of experimental JavaScript APIs, including What should I do?If wanted to run the Astro CLI programatically, you can use the new experimental JavaScript APIs: import { dev, build } from "astro";
// Start the Astro dev server
const devServer = await dev();
await devServer.stop();
// Build your Astro project
await build(); (PR: withastro/astro#7979) |
Deprecated the
|
Removed deprecated APIsIn Astro v2.x, deprecated config options, script/style attributes types, and Astro v3.0 these APIs are removed. What should I do?Use the new APIs for each feature instead:
(PR: withastro/astro#8170) |
Removed pre-shiki 0.14 theme namesIn Astro v2.x, a few Shiki theme names had been renamed, but the original names were kept for backwards compatibility. Astro v3.0 removes the original names in favour of the renamed theme names. What should I do?If you used the affected theme names below, rename them to the newer ones:
(PR: withastro/astro#8169) |
Changed how scoped style hashesIn Astro v2.x, scoped style hashes were uppercase. Astro v3.0 generates hashes in lowercase. Before: - <div class="astro-KOI4QYR5"></div>
+ <div class="astro-koi4qyr5"></div> What should I do?Nothing |
I am closing this (final v3.0) issue! 🥳 This is now our source of truth for breaking changes. Any corrections/updates before Wednesday can go directly to PR #4166 Deploy preview of the upgrade guide Thanks, everyone! I loved this process and it was exceptionally helpful. Let's do this again... BUT NOT SOON. 🙌 |
📋 Explain your issue
This issue is to track 3.0 breaking changes to be part of the guide. Will add things to this through comments, using this template:
Example upgrade guide: https://docs.astro.build/en/guides/upgrade-to/v2/
The text was updated successfully, but these errors were encountered: