MCPcopy
hub / github.com/vitejs/vite / buildApp

Function buildApp

packages/vite/src/node/build.ts:1831–1865  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1829 environments,
1830 config,
1831 async buildApp() {
1832 const pluginContext = new BasicMinimalPluginContext(
1833 { ...basePluginContextMeta, watchMode: false },
1834 config.logger,
1835 )
1836
1837 // order 'pre' and 'normal' hooks are run first, then config.builder.buildApp, then 'post' hooks
1838 let configBuilderBuildAppCalled = false
1839 for (const p of config.getSortedPlugins('buildApp')) {
1840 const hook = p.buildApp
1841 if (
1842 !configBuilderBuildAppCalled &&
1843 typeof hook === 'object' &&
1844 hook.order === 'post'
1845 ) {
1846 configBuilderBuildAppCalled = true
1847 await configBuilder.buildApp(builder)
1848 }
1849 const handler = getHookHandler(hook)
1850 await handler.call(pluginContext, builder)
1851 }
1852 if (!configBuilderBuildAppCalled) {
1853 await configBuilder.buildApp(builder)
1854 }
1855 // fallback to building all environments if no environments have been built
1856 if (
1857 Object.values(builder.environments).every(
1858 (environment) => !environment.isBuilt,
1859 )
1860 ) {
1861 for (const environment of Object.values(builder.environments)) {
1862 await builder.build(environment)
1863 }
1864 }
1865 },
1866 async build(
1867 environment: BuildEnvironment,
1868 ): Promise<RolldownOutput | RolldownOutput[] | RolldownWatcher> {

Callers

nothing calls this directly

Calls 3

getHookHandlerFunction · 0.90
buildAppMethod · 0.80
buildMethod · 0.80

Tested by

no test coverage detected