lunx.docs
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

FieldTypeDefaultDescription
frameworkstringRequired. Framework adapter: react, vue, svelte, angular, sveltekit, nuxt, remix, astro, qwik, solid, electron, tauri, and 7 more.
outDirstring'dist'Output directory for the production build.
basestring'/'Base public path. Set to '/app/' for sub-path deployments.
pluginsPlugin[][]Array of Lunx plugins hooking into the build lifecycle.
defineRecord<string,string>{}Global constants replaced at compile time by SWC.

Server options

FieldTypeDefaultDescription
server.portnumber5173Port to listen on. Auto-increments if already in use.
server.hostbooleanfalseExpose to local network. Set true or '0.0.0.0'.
server.httpsboolean | {key,cert}falseEnable HTTPS with auto or custom certificates.
server.openbooleanfalseAutomatically open browser when server starts.
server.corsbooleanfalseEnable CORS for all dev server requests.
server.proxyRecord<string, ProxyOptions>Proxy API requests to a backend server during development.
server.headersRecord<string,string>Custom HTTP response headers for dev server requests.

Build options

FieldTypeDefaultDescription
build.minifybooleantrueSWC minifies JS and LightningCSS minifies styles in parallel threads.
build.sourcemapboolean | 'inline'falseGenerate source maps. Use 'inline' to embed into files.
build.targetstring'es2020'Browser target for transpilation. E.g. 'chrome89', 'es2019'.
build.assetsInlineLimitnumber4096Files under this byte size are inlined as base64 data URIs.
build.cssCodeSplitbooleantrueCSS is split and loaded only with the chunk that uses it.
build.rollupOptionsRollupOptionsAdvanced Rollup options: manualChunks, external modules, output format.

Security options

FieldTypeDefaultDescription
security.scanSecretsbooleantrueScan source files for leaked API keys, tokens, credentials before every build.
security.checkCVEsbooleantrueQuery the OSV database for known CVEs in all project dependencies.
security.generateSBOMboolean | SBOMOptionsfalseGenerate a CycloneDX 1.5 SBOM in JSON or XML format.
security.sribooleanfalseInject SHA-384 Subresource Integrity hashes into all script/link tags.
security.failOnSeveritystring'high'Abort build on CVEs at this severity or above: low | moderate | high | critical.
security.excludePathsstring[][]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.