Skip to content

Commit

Permalink
Add unstable Vite Environment API support (#12936)
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish authored Feb 6, 2025
1 parent ac399b7 commit ca057a0
Show file tree
Hide file tree
Showing 21 changed files with 1,920 additions and 1,420 deletions.
5 changes: 5 additions & 0 deletions .changeset/thin-rockets-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@react-router/dev": patch
---

Add `future.unstable_viteEnvironmentApi` flag to enable experimental Vite Environment API support
7 changes: 5 additions & 2 deletions integration/helpers/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type { Config } from "@react-router/dev/config";

const require = createRequire(import.meta.url);

const reactRouterBin = "node_modules/@react-router/dev/dist/cli/index.js";
const reactRouterBin = "node_modules/@react-router/dev/bin.js";
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
const root = path.resolve(__dirname, "../..");
const TMP_DIR = path.join(root, ".tmp/integration");
Expand All @@ -29,6 +29,7 @@ export const reactRouterConfig = ({
prerender,
appDirectory,
splitRouteModules,
viteEnvironmentApi,
}: {
ssr?: boolean;
basename?: string;
Expand All @@ -37,6 +38,7 @@ export const reactRouterConfig = ({
splitRouteModules?: NonNullable<
Config["future"]
>["unstable_splitRouteModules"];
viteEnvironmentApi?: boolean;
}) => {
let config: Config = {
ssr,
Expand All @@ -45,6 +47,7 @@ export const reactRouterConfig = ({
appDirectory,
future: {
unstable_splitRouteModules: splitRouteModules,
unstable_viteEnvironmentApi: viteEnvironmentApi,
},
};

Expand Down Expand Up @@ -130,7 +133,7 @@ export const EXPRESS_SERVER = (args: {
app.listen(port, () => console.log('http://localhost:' + port));
`;

type TemplateName =
export type TemplateName =
| "vite-5-template"
| "vite-6-template"
| "vite-cloudflare-template";
Expand Down
Loading

0 comments on commit ca057a0

Please sign in to comment.