Experimental serialized configuration
Ce contenu n’est pas encore disponible dans votre langue.
Type: boolean
Default: false
astro@5.2.0
Nouveau
This feature allows access to the astro:config
virtual module which exposes a non-exhaustive, serializable, type-safe version of the Astro configuration through two sub-modules.
For a complete overview, and to give feedback on this experimental API, see the Serialized Manifest RFC.
To enable this virtual module, add the experimental.serializeConfig
feature flag to your Astro config:
Then, configuration values can be used by any file in your Astro project:
Submodules
Section titled SubmodulesThe virtual module exposes two submodules for accessing different subsets of your configuration values. This protects your information by only making some data available to the client.
All available config values can be accessed from astro:config/server
. However, for code executed on the client, only those values exposed by astro:config/client
will be available.
astro:config/client
Section titled astro:config/clientThe client submodule allows you to access a subset of the configuration values in astro:config/server
that are safe to expose to the browser such as trailingSlash
, build.format
, i18n
, and more. Use this submodule for client side code that is executed on the client.
This is a developing feature. For a full, up-to-date list of the configuration values available from astro:config/client
, please see the proposed API from the feature RFC
astro:config/server
Section titled astro:config/serverThe server submodule allows you to access a non-exhaustive set of your configuration values from astro.config.mjs
. This includes astro:config/client
values such as trailingSlash
and i18n
, but also more sensitive information about your file system configuration that is not safe to expose to the client such as srcDir
, cacheDir
, outDir
.
This is a developing feature. For a full, up-to-date list of the configuration values available from astro:config/server
, please see the proposed API from the feature RFC
so attempting to use them wil raise an error.