DocsConfiguration
Configuration API
Configure Lunx with a single TypeScript file. Full autocomplete, type safety, and zero-config defaults for every field.
lunx.config.ts
Place lunx.config.ts at your project root. The defineConfig helper provides full autocomplete and validation.
typescriptlunx.config.ts
import { defineConfig } from 'lunx' import compress from '@lunx/plugin-compress' export default defineConfig({ framework: 'react', outDir: 'dist', base: '/', server: { port: 5173, host: true, open: false, proxy: { '/api': 'http://localhost:8080' }, }, build: { minify: true, sourcemap: false, target: 'es2020', rollupOptions: { output: { manualChunks: { vendor: ['react','react-dom'] } } } }, security: { scanSecrets: true, checkCVEs: true, sri: true, generateSBOM: { format: 'json', outputFile: 'dist/bom.json' }, failOnSeverity: 'high', }, plugins: [compress({ algorithm: 'brotli' })], })
Top-level options
| Field | Type | Default | Description |
|---|---|---|---|
| framework | string | — | Required. Framework adapter: react, vue, svelte, angular, sveltekit, nuxt, remix, astro, qwik, solid, electron, tauri, and 7 more. |
| outDir | string | 'dist' | Output directory for the production build. |
| base | string | '/' | Base public path. Set to '/app/' for sub-path deployments. |
| plugins | Plugin[] | [] | Array of Lunx plugins hooking into the build lifecycle. |
| define | Record<string,string> | {} | Global constants replaced at compile time by SWC. |
Server options
| Field | Type | Default | Description |
|---|---|---|---|
| server.port | number | 5173 | Port to listen on. Auto-increments if already in use. |
| server.host | boolean | false | Expose to local network. Set true or '0.0.0.0'. |
| server.https | boolean | {key,cert} | false | Enable HTTPS with auto or custom certificates. |
| server.open | boolean | false | Automatically open browser when server starts. |
| server.cors | boolean | false | Enable CORS for all dev server requests. |
| server.proxy | Record<string, ProxyOptions> | — | Proxy API requests to a backend server during development. |
| server.headers | Record<string,string> | — | Custom HTTP response headers for dev server requests. |
Build options
| Field | Type | Default | Description |
|---|---|---|---|
| build.minify | boolean | true | SWC minifies JS and LightningCSS minifies styles in parallel threads. |
| build.sourcemap | boolean | 'inline' | false | Generate source maps. Use 'inline' to embed into files. |
| build.target | string | 'es2020' | Browser target for transpilation. E.g. 'chrome89', 'es2019'. |
| build.assetsInlineLimit | number | 4096 | Files under this byte size are inlined as base64 data URIs. |
| build.cssCodeSplit | boolean | true | CSS is split and loaded only with the chunk that uses it. |
| build.rollupOptions | RollupOptions | — | Advanced Rollup options: manualChunks, external modules, output format. |
Security options
| Field | Type | Default | Description |
|---|---|---|---|
| security.scanSecrets | boolean | true | Scan source files for leaked API keys, tokens, credentials before every build. |
| security.checkCVEs | boolean | true | Query the OSV database for known CVEs in all project dependencies. |
| security.generateSBOM | boolean | SBOMOptions | false | Generate a CycloneDX 1.5 SBOM in JSON or XML format. |
| security.sri | boolean | false | Inject SHA-384 Subresource Integrity hashes into all script/link tags. |
| security.failOnSeverity | string | 'high' | Abort build on CVEs at this severity or above: low | moderate | high | critical. |
| security.excludePaths | string[] | [] | Glob patterns excluded from secret scanning (e.g. test fixtures). |
Module Federation
First-class MFE support built into the Rust compiler — no Webpack required.
typescriptlunx.config.ts
export default defineConfig({ framework: 'react', federation: { name: 'dashboard', filename: 'remoteEntry.js', remotes: { auth: 'auth@http://localhost:5001/remoteEntry.js', profile: 'profile@http://localhost:5002/remoteEntry.js', }, exposes: { './Button': './src/components/Button.tsx', './StatCard':'./src/components/StatCard.tsx', }, shared: { react: { singleton: true, requiredVersion: '^18.0.0' }, 'react-dom': { singleton: true, requiredVersion: '^18.0.0' }, }, }, })
Environment-specific config
typescriptlunx.config.ts
import { defineConfig } from 'lunx' export default defineConfig(({ mode }) => ({ framework: 'react', build: { sourcemap: mode === 'development', minify: mode === 'production', }, define: { __APP_VERSION__: JSON.stringify(process.env.npm_package_version), __DEV__: JSON.stringify(mode === 'development'), }, }))
Path alias @/ built-in
Lunx maps
@/ to your src/ directory automatically. Add custom aliases via resolve.alias in the config.