From cd9b4fab7184f12b55414d8d140631d36d7708ce Mon Sep 17 00:00:00 2001 From: bluwy Date: Thu, 21 Nov 2024 22:01:49 +0800 Subject: [PATCH] fix --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 8747ecc..9f19c16 100644 --- a/src/index.ts +++ b/src/index.ts @@ -258,13 +258,13 @@ export default function solidPlugin(options: Partial = {}): Plugin { }, // @ts-ignore This hook only works in Vite 6 - async configEnvironment(_, config, opts) { + async configEnvironment(name, config, opts) { config.resolve ??= {}; // Emulate Vite default fallback for `resolve.conditions` if not set if (config.resolve.conditions == null) { // @ts-ignore These exports only exist in Vite 6 const { defaultClientConditions, defaultServerConditions } = await import('vite'); - if (config.consumer === 'client' || opts.isSsrTargetWebworker) { + if (config.consumer === 'client' || name === 'client' || opts.isSsrTargetWebworker) { config.resolve.conditions = [...defaultClientConditions]; } else { config.resolve.conditions = [...defaultServerConditions];