For dynamically configuring applications runtime features.
Runtime configurations can usually be configured under the runtime
of the modern.config.js
, such as the router configuration.
The configuration in modern.config.js
is determined at build time, If some configuration parameters are obtained at runtime, or if the configuration parameters are from a module (such as a component), then need use defineConfig
API configuration on runtime.
@modern-js/app-tools
has the same name API, Used to provide TS type for configuration, please distinguish them.
defineConfig
can configuring runtime.state、runtime.router etc.
defineConfig
before configuring a property, such as router
, you need to make sure that the modern.config.js
has been configured to enable this feature.
defineConfig
incoming configuration will be merged with the configuration in modern.config.js
. Taking router
as an example, the final application configuration is as follows: