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.
21 lines (20 loc) • 1.01 kB
TypeScript
import type { Plugin } from 'vite';
/**
* Creates a Vite plugin that forces the specified packages into the entry chunk,
* preventing them from being split into separate chunk files during code splitting.
*
* This works by:
* 1. Injecting a static import of each package at the top of the entry module,
* making the entry chunk directly depend on the package.
* 2. Marking all resolved modules belonging to the packages with
* `moduleSideEffects: 'no-treeshake'`, which prevents Rolldown from
* tree-shaking the injected import away (e.g. when the package declares
* `"sideEffects": false` in its package.json).
*
* Together this ensures the packages stay in the entry chunk even when they
* are only imported (directly or indirectly) by lazily loaded components.
*
* @param packages - Array of package names (e.g. `['@dynatrace/strato-node-graph']`).
* Both bare specifiers and subpath imports are matched.
*/
export declare function forceIntoMainBundle(packages: string[]): Plugin;