import { Plugin } from 'vite'; import { CompilerContext } from '../context/index.ts'; /** * By default, Rollup will bundle-in all dependencies. * * We change it as follows: * Externalize all packages that are defined as * "dependency" or "peerDependency" in the package.json. * If you wish to bundle-in some package, define it as a "devDependency". * * Bundling-in packages is not recommended because: * - it makes our build take longer * - it pushes larger packages to NPM * - user of our library is locked into the version of the package we bundled in * - if user has two packages using the same library, there will be two copies * served on the page * - It may break some libraries/prevent them from optimizing correctly * depending on the production/development mode, or prevent them from loading * correct code depending on browser/node.js environment. * * For example, see this statement from Lit: * https://lit.dev/docs/ssr/authoring/#:~:text=Don%27t%20bundle%20Lit,based%20on%20environment. * * @see {@link ./buildCdn.ts} for CDN dependency bundling details * * @remarks * If a dependency is both a peerDependency and a devDependency, it will still * be externalized (because all peerDependencies are externalized). */ export declare function externalizeDependencies(context: CompilerContext): Plugin;