vuedaViteConfig
Overview
Returns a Vite config fragment for vueda, covering define, resolve.alias, resolve.dedupe, and (optionally) optimizeDeps and server.fs.allow. Spread the result into your Vite defineConfig or merge it with mergeConfig.
The fragment guarantees a single copy of VUEDA, reactive-helpers, and their shared peer dependencies by listing them in resolve.dedupe, which forces every bare import (from any importer, including a linked package's own internal imports) to resolve from this project's root. This works regardless of whether the packages are installed or linked, and regardless of pnpm's symlinked/hoisted store layout.
When vueda is linked (pnpm link / file:) its source lives outside the consuming project, which Vite's dev server will not serve unless the path is on server.fs.allow. In that case the fragment returns a server.fs.allow listing the workspace root plus the linked vueda source realpath. The list mirrors Vite's default (the workspace root) so it is safe to spread; but if you also declare your own server block, spreading both will let the later one win and drop this allow-list. Merge instead: either wrap with mergeConfig(vuedaViteConfig(...), { server: { ... } }), or inside your server block preserve fs.allow (e.g. fs: { allow: [...(vueda.server?.fs?.allow ?? []), ...yourEntries] }).
Signature
vuedaViteConfig(options)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| options | object | no | Configuration options. |
options Properties
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| debug | boolean | Log the resolved wiring and dedupe strategy. Defaults to false. | ||
| enableDedupe | boolean | Whether to de-duplicate shared peer dependencies. Defaults to true. | ||
| enableRuntimeAliases | boolean | Whether to pin vue/pinia/vue-router to their bundler builds. Defaults to true. | ||
| excludeFromDedupe | string[] | Peer dependency names to leave out of resolve.dedupe. | ||
| extraAliases | any | Additional aliases to include. | ||
| extraDedupe | string[] | Additional package names to add to resolve.dedupe. | ||
| manageLinkedOptimizeDeps | boolean | Manage dep pre-bundling for linked packages: pre-bundle linked reactive-helpers (single instance) and keep linked VUEDA as source. Defaults to true. | ||
| optimizeDeps | any | Vite optimizeDeps overrides (merged with the computed include/exclude). | ||
| root | string | The project root directory. Defaults to process.cwd(). |
Returns
UserConfig
A partial Vite config fragment.
Source
client/lib/vite.js:151