Skip to content
Luna
Esc
↑↓navigate↵open⌘Jpreview
On this page

defineConfig

Name the modules that export your app's luna types, in the app's luna.config.ts.

defineConfig names the modules whose exports are your app’s luna types. It is the default export of luna.config.ts.

import { defineConfig } from "luna";

export default defineConfig({ lunas: "./lunas/list.ts" });

Reference

defineConfig(config)

import { defineConfig } from "luna";
PropType
configLunaConfig

Where the app's luna types are exported from.

TypeLunaConfig

Returns the same LunaConfig. It throws if lunas names no module.

LunaConfig

PropType
lunasstring | string[]

The module whose exports are the app's luna types, relative to the config file, or one module for each language.

Typestring | string[]

Good to know

  • The file is called luna.config.ts and must have export default defineConfig({...}). It stays TypeScript when your lunas are written in Python.
  • luna dev and luna deploy look for luna.config.ts in the folder given by --dir, the current folder by default. If it is not there, they look in that folder’s luna folder.
  • Each module must be inside the folder that holds the config.
  • A module ending in .py is read by the Python SDK. Every other module is loaded with Node.js.
  • Every export of a module that is a luna type is deployed. Other exports are ignored. A module that exports no luna type fails the deploy, and so do two luna types with the same name.
  • The config does not say where the app deploys. The project and environment come from .env.local, which luna projects use and luna env use write. A config that still names a project loads, and luna deploy warns you to take the field out.

Examples

Export luna types from several files

Point the config at one module that re-exports the others.

import { defineConfig } from "luna";

export default defineConfig({ lunas: "./lunas/index.ts" });
export { List } from "./list.ts";
export { Board } from "./board.ts";

Mix TypeScript and Python

Name one module for each language. Each language’s lunas can call the other’s, as Write lunas in Python shows.

import { defineConfig } from "luna";

export default defineConfig({ lunas: ["./lunas/index.ts", "./lunas/wallet.py"] });

Was this page helpful?