|
1 | 1 | import { resolve } from 'node:path' |
2 | | - |
3 | | -import { |
4 | | - CONFIG_FILE, |
5 | | - addToApp, |
6 | | - createAppOptionsFromPersisted, |
7 | | - createDefaultEnvironment, |
8 | | - createSerializedOptionsFromPersisted, |
9 | | - readConfigFile, |
10 | | - recursivelyGatherFiles, |
11 | | - writeConfigFileToEnvironment, |
12 | | -} from '@tanstack/cta-engine' |
13 | | - |
14 | 2 | import { TMP_TARGET_DIR } from '../constants' |
15 | | - |
16 | | -import { cleanUpFileArray, cleanUpFiles } from './file-helpers' |
17 | | -import { getProjectPath } from './server-environment' |
18 | | -import { createAppWrapper } from './create-app-wrapper' |
19 | | - |
20 | | -import type { Environment } from '@tanstack/cta-engine' |
21 | 3 | import type { Response } from 'express' |
22 | 4 | import type { DryRunOutput } from '../types' |
23 | | -import { createMemoryEnvironment } from './memory-environment' |
24 | 5 |
|
25 | 6 | export async function addToAppWrapper( |
26 | 7 | addOns: Array<string>, |
27 | 8 | opts: { |
28 | 9 | dryRun?: boolean |
29 | 10 | response?: Response |
30 | | - environmentFactory?: () => Environment |
| 11 | + environmentFactory?: () => any |
31 | 12 | } |
32 | 13 | ) { |
| 14 | + // Dynamically import CTA engine to prevent client bundling |
| 15 | + const { |
| 16 | + CONFIG_FILE, |
| 17 | + addToApp, |
| 18 | + createAppOptionsFromPersisted, |
| 19 | + createDefaultEnvironment, |
| 20 | + createSerializedOptionsFromPersisted, |
| 21 | + readConfigFile, |
| 22 | + recursivelyGatherFiles, |
| 23 | + writeConfigFileToEnvironment, |
| 24 | + } = await import('@tanstack/cta-engine') |
| 25 | + const { cleanUpFileArray, cleanUpFiles } = await import('./file-helpers') |
| 26 | + const { getProjectPath } = await import('./server-environment') |
| 27 | + const { createAppWrapper } = await import('./create-app-wrapper') |
| 28 | + const { createMemoryEnvironment } = await import('./memory-environment') |
| 29 | + |
33 | 30 | const projectPath = getProjectPath() |
34 | 31 |
|
35 | 32 | const persistedOptions = await readConfigFile(projectPath) |
|
0 commit comments