Skip to main content

Reference: Vite Workflow Configuration

Configuration​

@availity/workflow-vite is configured via project/config/workflow.js. The file should use ESM syntax.

Object Form​

/** @type {import('@availity/workflow-vite').WorkflowViteConfig} */
export default {
development: {
port: 3000,
open: '/',
},
app: {
title: 'My App',
},
};

Function Form​

/** @type {import('@availity/workflow-vite').WorkflowViteConfigFunction} */
export default (config) => {
config.development.open = '/';
return config;
};

Options​

development.open​

URL path to open in the default browser when the dev server starts. Default: '/' (opens at root). Set to false to disable.

development.notification​

Enable build status system notifications. Default: true.

development.host​

Vite dev server host. Default: 'localhost'.

development.port​

Vite dev server port. If unavailable, the next open port is used automatically. Default: 3000.

development.sourceMap​

Enable source maps in development. Default: true.

development.babelInclude​

⚠️ Deprecated. Use development.vitestOverrides.inlineDeps instead. The name is a webpack-era holdover — Vite does not use Babel for this purpose.

Additional node_modules packages to transform during testing. Default: [].

development.optimizeDeps​

Additional packages to add to Vite's optimizeDeps.include list for the dev server and builds. Merged with the built-in defaults (react, react-dom, react-dom/client, react-router, axios). Use this for packages that have ESM/CJS compatibility issues and need pre-bundling.

export default {
development: {
optimizeDeps: ['@availity/spaces', 'dayjs'],
},
};

development.vitestOverrides​

Vitest configuration overrides merged directly into the test config. Options are additive — you only need to specify what you want to change. See Vitest config reference for the full list.

OptionTypeDescription
poolstring'vmThreads' (default), 'forks', or 'threads'
environmentstring'jsdom' (default), 'happy-dom', or 'node'
testTimeoutnumberTest timeout in ms (default: 5000)
setupFilesstring | string[]Additional setup files — appended to the internal list
inlineDepsstring | RegExp | ...Extra packages to inline through Vite's transform pipeline
fallbackCJSbooleanTry CJS build for packages with broken ESM (default: true)
optimizeDepsstring | string[]Extra packages to pre-bundle for faster startup
excludestring | string[]Additional glob patterns to exclude from test discovery
resolveConditionsstring[]Override the module resolution condition list (default: ['browser', 'module', 'import', 'default'])
coverageobjectAny Vitest coverage options — merged with defaults

Note on clearMocks: Vitest 5 changed the default for clearMocks to true. @availity/workflow-vite explicitly pins it to false to preserve existing test behavior. To auto-clear mocks before each test, opt in via vitestOverrides.clearMocks: true.

export default (config) => {
config.development.vitestOverrides = {
setupFiles: ['./vitest.setup.js'],
coverage: {
reporter: ['text', 'html'],
},
};
return config;
};

development.typeCheck​

Enable TypeScript type checking during the dev server and production builds. When true, tsc --noEmit runs in a worker thread via vite-plugin-checker so it does not block Vite's HMR. Type errors appear in the terminal during development and will fail yarn build.

Default: false.

Requires a tsconfig.json in the project root. If no tsconfig.json is found, the option is silently ignored.

/** @type {import('@availity/workflow-vite').WorkflowViteConfig} */
export default {
development: {
typeCheck: true,
},
};

TypeScript version support: @availity/workflow-vite supports TypeScript ^5.0.0 || ^6.0.0. The version installed in your project is used automatically — no additional configuration required.

app.title​

Page title for the generated HTML document. Default: 'Availity'.

globals​

Global constants for feature flags. Values can be overridden via environment variables.

export default {
globals: {
EXPERIMENTAL_FEATURE: false,
},
};

Built-in globals:

  • __DEV__ — true when NODE_ENV is development
  • __TEST__ — true when NODE_ENV is test
  • __PROD__ — true when NODE_ENV is production
  • __STAGING__ — true when NODE_ENV is staging

ekko​

Mock server configuration (uses @availity/mock-server internally).

OptionDefaultDescription
enabledtrueEnable/disable mock server
port9999Mock server port
latency250Response delay in ms
dataproject/dataMock data folder
routesproject/config/routes.jsonRoute config file
plugins['@availity/mock-data']Mock data plugins
pluginContexthttp://localhost:{port}/apiContext for HATEOAS links

proxies​

Array of proxy configurations. Default proxies /api, /ms, and /cloud to the mock server.

export default {
proxies: [
{
context: ['/api', '/ms'],
target: 'http://localhost:9999',
enabled: true,
logLevel: 'info',
pathRewrite: { '^/api': '' },
headers: { RemoteUser: 'jsmith' },
},
],
};

eslint​

ESLint checker options for the Vite dev server and lint script.

OptionDefaultDescription
failOnErrortrueFail the build on lint errors
failOnWarningfalseFail the build on lint warnings
fixfalseAutomatically fix fixable ESLint problems
quietfalseReport errors only — suppress warnings from lint output
maxWarnings(unset)Number of warnings allowed before lint fails. Overrides failOnWarning when set (e.g. 0 = fail on any warning)
watchPath(unset)Path or glob patterns to watch for changes during dev server lint checking. Defaults to the app directory. Useful when linting files outside project/app

modifyViteConfig​

Hook to customize the Vite configuration. Receives the resolved Vite config and workflow settings.

export default (config) => {
config.modifyViteConfig = (viteConfig, settings) => {
// Example: add a custom alias
viteConfig.resolve.alias['@utils'] = '/project/app/utils';
return viteConfig;
};
return config;
};