Skip to content

Commit 44cfda7

Browse files
committed
fix(env): resolver
1 parent cdbfb59 commit 44cfda7

File tree

1 file changed

+7
-5
lines changed
  • packages/start/src/config

1 file changed

+7
-5
lines changed

packages/start/src/config/env.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function convertObjectToModule(object: Record<string, string>): string {
4343
for (const key in object) {
4444
result += `export const ${key} = ${JSON.stringify(object[key])};`;
4545
}
46+
console.log(result);
4647
return result;
4748
}
4849

@@ -65,26 +66,27 @@ export function envPlugin(options?: EnvPluginOptions): Plugin {
6566
id === SERVER_ENV ||
6667
id === CLIENT_ENV ||
6768
id === SERVER_RUNTIME_ENV ||
68-
SERVER_RUNTIME_LOADER
69+
id === SERVER_RUNTIME_LOADER
6970
) {
7071
return id;
7172
}
72-
return null;
73+
return undefined;
7374
},
7475
load(id, opts) {
7576
if (id === SERVER_ENV) {
7677
if (!opts?.ssr) {
7778
return SERVER_ONLY_MODULE;
7879
}
80+
console.log('LOAD SERVER');
7981
const vars = currentOptions.server?.load
8082
? currentOptions.server.load()
81-
: loadEnv(env, false, serverPrefix);
83+
: loadEnv(env, '.', serverPrefix);
8284
return convertObjectToModule(vars);
8385
}
8486
if (id === CLIENT_ENV) {
8587
const vars = currentOptions.client?.load
8688
? currentOptions.client.load()
87-
: loadEnv(env, false, clientPrefix);
89+
: loadEnv(env, '.', clientPrefix);
8890
return convertObjectToModule(vars);
8991
}
9092
if (id === SERVER_RUNTIME_LOADER) {
@@ -99,7 +101,7 @@ export function envPlugin(options?: EnvPluginOptions): Plugin {
99101
}
100102
return SERVER_RUNTIME_CODE;
101103
}
102-
return null;
104+
return undefined;
103105
},
104106
};
105107
}

0 commit comments

Comments
 (0)