dt-app
Version:
The Dynatrace App Toolkit is a tool you can use from your command line to create, develop, and deploy apps on your Dynatrace environment.
29 lines (28 loc) • 1.9 kB
TypeScript
import type { PluginOption } from 'vite';
import type { UiFilePaths } from '../../utils/config/cli-options';
import type { shouldApplySourcemaps } from '../../build/utils/should-apply-sourcemaps';
import { type TypeScriptErrorHolder } from './plugins/dt-error-overlay/dt-error-overlay-plugin';
/**
* Builds the ordered plugin list for the Vite dev server.
*
* Order matters — each slot is intentional:
*
* 1. `dt-private-network-access` — Must be first; sets the response header before
* any middleware can end the response.
* 2. `react` — React Fast Refresh transform.
* 3. User Vite plugins — App-level vite plugins from `build.ui.plugins`.
* 4. `excludeVendorFromSourceMap` — Optional; strips vendor source maps when sourcemaps are
* enabled but `includeVendorSourceMaps` is false.
* 5. `dtFunctionVitePlugin` — Proxies `/api/*` calls to esbuild-bundled functions.
* 6. `dtAppfwVitePlugin` — App-framework (appfw) middleware.
* 7. `dtCspVitePlugin` — Injects Content-Security-Policy headers.
* 8. `dtWidgetVitePlugin` — Serves each widget document via Vite's transform
* pipeline (HMR); must run before the router so it wins `/widgets/*` HTML routes.
* 9. `dtRouterVitePlugin` — Handles app-level client-side routing.
* 10. `dtHtmlPlugin` — Transforms `index.html` (injects scripts, base href, etc.).
* 11. `dtErrorOverlayPlugin` — Displays TypeScript errors as an in-browser overlay.
*
* TypeScript path aliases (`resolve.tsconfigPaths`) are handled natively by Vite
* via the `resolve.tsconfigPaths` config option, not as a plugin.
*/
export declare function createDevPlugins(uiFilePaths: UiFilePaths, errorHolder: TypeScriptErrorHolder, userVitePlugins: PluginOption[], sourceMapOptions: ReturnType<typeof shouldApplySourcemaps>): PluginOption[];