Imports and packages

Most applications only need the compdi package.

Macro imports

import {
  createSingleton,
  defineSingleton,
  createTransient,
  defineTransient,
  createScoped,
  defineScoped,
  defineAppTeardown,
} from "compdi/macros";

Plugin imports

import compdi from "compdi/plugin/vite";
import compdi from "compdi/plugin/rollup";
import compdi from "compdi/plugin/rolldown";
import compdi from "compdi/plugin/rspack";
import compdi from "compdi/plugin/esbuild";

You can also import the macro API from @compdi/core and install unplugin-compdi separately. Those packages are useful for integrations and tooling; application code should generally prefer the consolidated compdi entry points.

PackagePurpose
compdiRecommended application package; exports macros and plugin adapters.
@compdi/coreMacro type signatures and lifecycle types.
unplugin-compdiBuild-time transform and individual build-tool adapters.

Use one import style consistently within an application. Mixing compdi/macros and @compdi/core is supported, but usually makes dependency ownership harder to scan.