[data-reveal]{opacity:1!important;transform:none!important}
Auto-imports
Frontend

Auto-imports

Declare which directories of a module are auto-imported across the application, in dms.frontend.build.ts.

Nothing a module ships is auto-imported unless the module declares it, in an optional dms.frontend.build.ts next to its dms.frontend.ts:

dms.frontend.build.ts
import { defineDmsFrontendBuild } from "#dms/frontend-build";

export default defineDmsFrontendBuild((build) => {
  build.registerAutoImports([
    "layers/*/app/composables",
    "layers/*/app/utils",
    "layers/*/app/types",
  ]);
});

Each entry is a directory relative to the module root, glob patterns allowed. Every export of the files under it becomes available to the whole application without an import, in scripts and templates. A module without the file has nothing auto-imported.

Private code stays private

app/build/ holds a module's private code and is never auto-imported. A broader entry leaves it out, and an entry that names it, or a directory outside the module, is ignored with a warning when Vite starts. The module's own files import that code by path.

Where it runs

The file runs in Node.js when Vite starts, under ajs dms dev and ajs dms build, not in the application. It may import #dms/frontend-build and Node.js built-ins, never the application's code. Vite restarts when the file changes.

Up to 0.3, every module's app/composables, app/types, app/utils, app/build/composables and app/build/types were auto-imported. A module that relies on auto-imports declares its public directories here, and imports its app/build/ code by path.