Skip to content

Commit 1f3a606

Browse files
committed
fix: replace obsolete vite env references with VITE_ENVIRONMENTS constant
1 parent d72927f commit 1f3a606

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

packages/start/src/config/fs-routes/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { relative } from "node:path";
2-
import type { PluginOption, ResolvedConfig } from "vite";
2+
import type { PluginOption } from "vite";
33

4+
import { VITE_ENVIRONMENTS } from "../../constants.js";
45
import { fileSystemWatcher } from "./fs-watcher.js";
56
import type { BaseFileSystemRouter } from "./router.js";
67
import { treeShake } from "./tree-shake.js";
@@ -57,7 +58,7 @@ export function fsRoutes({ routers }: FsRoutesArgs): Array<PluginOption> {
5758
src: relative(root, buildId),
5859
build: isBuild ? `_$() => import(/* @vite-ignore */ '${buildId}')$_` : undefined,
5960
import:
60-
this.environment.name === "server"
61+
this.environment.name === VITE_ENVIRONMENTS.server
6162
? `_$() => import(/* @vite-ignore */ '${buildId}')$_`
6263
: `_$(() => clientManifestImport('${relative(root, buildId)}'))$_`
6364
};
@@ -69,7 +70,7 @@ export function fsRoutes({ routers }: FsRoutesArgs): Array<PluginOption> {
6970

7071
const code = `
7172
${js.getImportStatements()}
72-
${this.environment.name === "server"
73+
${this.environment.name === VITE_ENVIRONMENTS.server
7374
? ""
7475
: `
7576
import { getClientManifest } from "solid-start:get-client-manifest";

packages/start/src/config/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function solidStartVitePlugin(options?: SolidStartOptions): Array<PluginOption>
8383
configEnvironment(name) {
8484
return {
8585
define: {
86-
"import.meta.env.SSR": JSON.stringify(name === "server")
86+
"import.meta.env.SSR": JSON.stringify(name === VITE_ENVIRONMENTS.server)
8787
}
8888
};
8989
},

packages/start/src/config/nitroPlugin.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { promises as fsp } from "node:fs";
2-
import path, { dirname, resolve } from "node:path";
31
import {
42
createApp,
53
createEvent,
@@ -16,6 +14,8 @@ import {
1614
prepare,
1715
prerender,
1816
} from "nitropack";
17+
import { promises as fsp } from "node:fs";
18+
import path, { dirname, resolve } from "node:path";
1919
import {
2020
type Connect,
2121
type EnvironmentOptions,
@@ -129,7 +129,7 @@ export function nitroPlugin(
129129
{
130130
name: "solid-start-vite-plugin-nitro",
131131
configEnvironment(name) {
132-
if (name === "server") {
132+
if (name === VITE_ENVIRONMENTS.server) {
133133
return {
134134
build: {
135135
commonjsOptions: {
@@ -151,8 +151,8 @@ export function nitroPlugin(
151151
builder: {
152152
sharedPlugins: true,
153153
async buildApp(builder) {
154-
const clientEnv = builder.environments["client"];
155-
const serverEnv = builder.environments["server"];
154+
const clientEnv = builder.environments[VITE_ENVIRONMENTS.client];
155+
const serverEnv = builder.environments[VITE_ENVIRONMENTS.server];
156156

157157
if (!clientEnv) throw new Error("Client environment not found");
158158
if (!serverEnv) throw new Error("SSR environment not found");

0 commit comments

Comments
 (0)