Skip to content

Resolve Options

The resolve block configures module resolution — currently import aliases, shared by dev, build, HTML, and CSS through a single resolver. See the Aliases guide.

ts
import { defineConfig } from "vantris";

export default defineConfig({
  resolve: {
    alias: {
      "@": "./src",
      "~": "./shared",
    },
  },
});

resolve.alias

  • Type: Record<string, string>
  • Default: unset → falls back to tsconfig.json

Import aliases. Each key is matched as a prefix and replaced with a path (relative to root, or absolute). Applied everywhere a specifier is resolved — JS/TS, CSS @import and url(), and HTML src/href.

ts
resolve: {
  alias: {
    "@": "./src",
    "@components": "./src/components",
  },
}
ts
import { thing } from "@/thing";   // → ./src/thing
css
@import "@/styles/base.css";        /* → ./src/styles/base.css */

tsconfig fallback

When resolve.alias is omitted entirely, Vantris reads compilerOptions.paths from your tsconfig.json (resolved against baseUrl) as your aliases:

jsonc
// tsconfig.json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": { "@/*": ["./src/*"] }
  }
}

This makes @/* work with zero Vantris config.

Explicit config wins, all-or-nothing

An explicit resolve.alias always takes precedence and the tsconfig fallback is ignored. It's not a merge — defining even one alias in the config disables the tsconfig paths fallback entirely.

Matching order

Keys match as prefixes. List longer, more specific keys first so they win over shorter ones:

ts
resolve: {
  alias: {
    "@/components": "./src/components", // specific
    "@": "./src",                        // fallback
  },
}

Reserved for future versions

The ResolveConfig interface is shaped to grow. Fields like extensions (override resolution extensions) and conditions (export-map conditions) are reserved in the source but not yet active.

ResolveConfig at a glance

ts
interface ResolveConfig {
  alias?: Record<string, string>;
}

Released under the MIT License.