
✨ Major Changes
-
#8188
d0679a666Thanks @ematipico! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023. -
#8188
364d861bdThanks @ematipico! - Removed automatic flattening ofgetStaticPathsresult..flatMapand.flatshould now be used to ensure that you’re returning a flat array. -
#8113
2484dc408Thanks @Princesseuh! - This import alias is no longer included by default with astro:assets. If you were using this alias with experimental assets, you must convert them to relative file paths, or create your own import aliases.src/pages/posts/post-1.astro ---import rocket from '~/assets/rocket.png'import rocket from '../../assets/rocket.png';--- -
#8142
81545197aThanks @natemoo-re! - Fixes for theclass:listdirective- Previously,
class:listwould ocassionally not be merged theclassprop when passed to Astro components. Now,class:listis always converted to aclassprop (as a string value). - Previously,
class:listdiverged fromclsxin a few edge cases. Now,class:listusesclsxdirectly.class:listused to deduplicate matching values, but it no longer doesclass:listused to sort individual values, but it no longer doesclass:listused to supportSetand other iterables, but it no longer does
- Previously,
-
#8179
6011d52d3Thanks @matthewp! - Astro 3.0 Release Candidate -
#8188
80f1494cdThanks @ematipico! - Thebuild.splitandbuild.excludeMiddlewareconfiguration options are deprecated and have been replaced by options in the adapter config.If your config includes the
build.excludeMiddlewareoption, replace it withedgeMiddlewarein your adapter options:import { defineConfig } from "astro/config";import netlify from "@astrojs/netlify/functions";export default defineConfig({build: {excludeMiddleware: true},adapter: netlify({edgeMiddleware: true}),});If your config includes the
build.splitoption, replace it withfunctionPerRoutein your adapter options:import { defineConfig } from "astro/config";import netlify from "@astrojs/netlify/functions";export default defineConfig({build: {split: true},adapter: netlify({functionPerRoute: true}),}); -
#8207
e45f30293Thanks @natemoo-re! - Change the View Transition built-in animation options.The
transition:animatevaluemorphhas been renamed toinitial. Also, this is no longer the default animation.If no
transition:animatedirective is specified, your animations will now default tofade.Astro also supports a new
transition:animatevalue,none. This value can be used on a page’s<html>element to disable animated full-page transitions on an entire page. -
#8188
c0de7a7b0Thanks @ematipico! - Sharp is now the default image service used forastro:assets. If you would prefer to still use Squoosh, you can update your config with the following:import { defineConfig, squooshImageService } from 'astro/config';// https://astro.build/configexport default defineConfig({image: {service: squooshImageService(),},});However, not only do we recommend using Sharp as it is faster and more reliable, it is also highly likely that the Squoosh service will be removed in a future release.
-
#8188
3c3100851Thanks @ematipico! - Remove support forAstro.__renderMarkdownwhich is used by@astrojs/markdown-component.The
<Markdown />component was deprecated in Astro v1 and is completely removed in v3. This integration must now be removed from your project.As an alternative, you can use community packages that provide a similar component like https://github.com/natemoo-re/astro-remote instead.
-
#8019
34cb20021Thanks @bluwy! - Remove backwards-compatible kebab-case transform for camelCase CSS variable names passed to thestyleattribute. 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:---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><style>div {color: var(--my-value);color: var(--myValue);}</style> -
#8170
be6bbd2c8Thanks @bluwy! - Remove deprecated config option types, deprecated script/style attributes, and deprecatedimageexport fromastro:content -
#8188
7511a4980Thanks @ematipico! - When using an adapter that supports neither Squoosh or Sharp, Astro will now automatically use an image service that does not support processing, but still provides the other benefits ofastro:assetssuch as enforcingalt, no CLS etc to users -
#7979
dbc97b121Thanks @bluwy! - Export experimentaldev,build,preview, andsyncAPIs fromastro. These APIs allow you to run Astro’s commands programmatically, and replaces the previous entry point that runs the Astro CLI.While these APIs are experimental, the inline config parameter is relatively stable without foreseeable changes. However, the returned results of these APIs are more likely to change in the future.
import { dev, build, preview, sync, type AstroInlineConfig } from 'astro';// Inline Astro config object.// Provide a path to a configuration file to load or set options directly inline.const inlineConfig: AstroInlineConfig = {// Inline-specific options...configFile: './astro.config.mjs',logLevel: 'info',// Standard Astro config options...site: 'https://example.com',};// Start the Astro dev serverconst devServer = await dev(inlineConfig);await devServer.stop();// Build your Astro projectawait build(inlineConfig);// Preview your built projectconst previewServer = await preview(inlineConfig);await previewServer.stop();// Generate types for your Astro projectawait sync(inlineConfig); -
#8188
7d2f311d4Thanks @ematipico! - Removed support for old syntax of the API routes. -
#8085
68efd4a8bThanks @bluwy! - Remove exports forastro/internal/*andastro/runtime/server/*in favour ofastro/runtime/*. Add newastro/compiler-runtimeexport for compiler-specific runtime code.These are exports 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';import { transform } from '@astrojs/compiler';const result = await transform(source, {internalURL: 'astro/runtime/server/index.js',internalURL: 'astro/compiler-runtime',// ...}); -
#7893
7bd1b86f8Thanks @ematipico! - Implements a new scope style strategy called"attribute". When enabled, styles are applied usingdata-*attributes.The default value of
scopedStyleStrategyis"attribute".If you want to use the previous behaviour, you have to use the
"where"option:import { defineConfig } from 'astro/config';export default defineConfig({scopedStyleStrategy: 'where',}); -
#7924
519a1c4e8Thanks @matthewp! - Astro’s JSX handling has been refactored with better support for each framework.Previously, Astro automatically scanned your components to determine which framework-specific transformations should be used. In practice, supporting advanced features like Fast Refresh with this approach proved difficult.
Now, Astro determines which framework to use with
includeandexcludeconfig options where you can specify files and folders on a per-framework basis. When using multiple JSX frameworks in the same project, users should manually control which files belong to each framework using theincludeandexcludeoptions.export default defineConfig({// The `include` config is only needed in projects that use multiple JSX frameworks;// if only using one no extra config is needed.integrations: [preact({include: ['**/preact/*'],}),react({include: ['**/react/*'],}),solid({include: ['**/solid/*'],}),],}); -
#8030
5208a3c8fThanks @natemoo-re! - Removed duplicateastro/dist/jsxexport. Please use theastro/jsxexport instead -
#8188
84af8ed9dThanks @ematipico! - Remove MDX plugin re-ordering hack -
#8180
f003e7364Thanks @ematipico! - The scoped hash created by the Astro compiler is now lowercase. -
#7878
0f637c71eThanks @bluwy! - The value ofimport.meta.env.BASE_URL, which is derived from thebaseoption, will no longer have a trailing slash added by default or whentrailingSlash: "ignore"is set. The existing behavior ofbasein combination withtrailingSlash: "always"ortrailingSlash: "never"is unchanged.If your
basealready has a trailing slash, no change is needed.If your
basedoes not have a trailing slash, add one to preserve the previous behaviour:astro.config.mjs base: 'my-base',base: 'my-base/', -
#8118
8a5b0c1f3Thanks @lilnasy! - Astro is smarter about CSS! Small stylesheets are now inlined by default, and no longer incur the cost of additional requests to your server. Your visitors will have to wait less before they see your pages, especially those in remote locations or in a subway.This may not be news to you if you had opted-in via the
build.inlineStylesheetsconfiguration. Stabilized in Astro 2.6 and set to “auto” by default for Starlight, this configuration allows you to reduce the number of requests for stylesheets by inlining them into