configEnvironmentPlugin() — astro Function Reference
Architecture documentation for the configEnvironmentPlugin() function in index.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 4ff4142f_c50f_9849_9cd3_c0e2da03ea5b["configEnvironmentPlugin()"] 887e50cb_5b90_14c0_7284_65712ec294a4["index.ts"] 4ff4142f_c50f_9849_9cd3_c0e2da03ea5b -->|defined in| 887e50cb_5b90_14c0_7284_65712ec294a4 style 4ff4142f_c50f_9849_9cd3_c0e2da03ea5b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/integrations/preact/src/index.ts lines 72–118
function configEnvironmentPlugin(compat: boolean | undefined): Plugin {
return {
name: '@astrojs/preact:environment',
configEnvironment(environmentName, options) {
const environmentOptions: EnvironmentOptions = {
optimizeDeps: {},
resolve: {},
};
if (environmentName === 'client') {
environmentOptions.optimizeDeps!.include = [
'@astrojs/preact/client.js',
'preact',
'preact/jsx-runtime',
];
}
if (compat) {
environmentOptions.resolve = {
dedupe: ['preact/compat', 'preact'],
};
if (environmentName === 'client') {
environmentOptions.optimizeDeps!.include!.push(
'preact/compat',
'preact/test-utils',
'preact/compat/jsx-runtime',
);
}
if (
!options.resolve?.noExternal &&
(environmentName === 'ssr' || environmentName === 'prerender')
) {
// noExternal React entrypoints to be bundled, resolved, and aliased by Vite
environmentOptions.resolve!.noExternal = [
'react',
'react-dom',
'react-dom/test-utils',
'react/jsx-runtime',
];
}
}
return environmentOptions;
},
};
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does configEnvironmentPlugin() do?
configEnvironmentPlugin() is a function in the astro codebase, defined in packages/integrations/preact/src/index.ts.
Where is configEnvironmentPlugin() defined?
configEnvironmentPlugin() is defined in packages/integrations/preact/src/index.ts at line 72.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free