MCPcopy
hub / github.com/TanStack/router / buildApp

Function buildApp

packages/start-plugin-core/src/plugin.ts:322–358  ·  view source on GitHub ↗
(builder)

Source from the content-addressed store, hash-verified

320 builder: {
321 sharedPlugins: true,
322 async buildApp(builder) {
323 const client = builder.environments[VITE_ENVIRONMENT_NAMES.client]
324 const server = builder.environments[VITE_ENVIRONMENT_NAMES.server]
325
326 if (!client) {
327 throw new Error('Client environment not found')
328 }
329
330 if (!server) {
331 throw new Error('SSR environment not found')
332 }
333
334 if (!client.isBuilt) {
335 // Build the client bundle first
336 await builder.build(client)
337 }
338 if (!server.isBuilt) {
339 // Build the SSR bundle
340 await builder.build(server)
341 }
342
343 // If a custom provider environment is configured (not SSR),
344 // build it last so the manifest includes functions from all environments
345 if (!ssrIsProvider) {
346 const providerEnv = builder.environments[serverFnProviderEnv]
347 if (!providerEnv) {
348 throw new Error(
349 `Provider environment "${serverFnProviderEnv}" not found`,
350 )
351 }
352 if (!providerEnv.isBuilt) {
353 // Build the provider environment last
354 // This ensures all server functions are discovered from client/ssr builds
355 await builder.build(providerEnv)
356 }
357 }
358 },
359 },
360 }
361 },

Callers

nothing calls this directly

Calls 1

buildMethod · 0.80

Tested by

no test coverage detected