Skip to content

Comments

feat: support config as callback with env context#380

Draft
2wheeh wants to merge 4 commits intowevm:mainfrom
2wheeh:feat/callback-config
Draft

feat: support config as callback with env context#380
2wheeh wants to merge 4 commits intowevm:mainfrom
2wheeh:feat/callback-config

Conversation

@2wheeh
Copy link

@2wheeh 2wheeh commented Jan 9, 2026

Description

Add callback-style config support.

Changes

1. Pass env from vite.config.ts to resolveVocsConfig()

Before: env was not passed, always defaulted to { command: 'serve', mode: 'development' }

After: Vite's ConfigEnv is forwarded properly (except isSsrBuild - I guess it's not needed for vocs?)

2. Separate defineConfig / resolveConfig

defineConfig: Type helper passthrough:

  • Supports env inference for callback usage
  • Trade-off: callback overloads take priority, so colorScheme generic only works for object form

resolveConfig: Resolves callback/object and parses config:

Since defineConfig is now a passthrough (lazy), parsing happens in resolveVocsConfig via resolveConfig.

Usage

Better support monorepo with tsconfig customConditions resolving exports.source in dev mode:

export default defineConfig(({ mode }) => ({
  vite: {
    resolve: {
      ...(mode === 'development' && {
        conditions: ['source', 'module', 'browser', 'default'],
      }),
    },
  },
}))

(This is actually why I opened this PR)

@vercel
Copy link

vercel bot commented Jan 9, 2026

@2wheeh is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@2wheeh
Copy link
Author

2wheeh commented Jan 13, 2026

I will rework based on v2

@2wheeh 2wheeh marked this pull request as draft January 13, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant