Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(remix-dev/vite): make installGlobals opt-in for Vite dev #8119

Merged
merged 7 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .changeset/tidy-timers-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
"@remix-run/dev": patch
---

Remove automatic global Node polyfill installation from the built-in Vite dev server and instead allow explicit opt-in.

**This is a breaking change for projects using the unstable Vite plugin without a custom server.**

If you're not using a custom server, you should call `installGlobals` in your Vite config instead.

```diff
import { unstable_vitePlugin as remix } from "@remix-run/dev";
+import { installGlobals } from "@remix-run/node";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

+installGlobals();

export default defineConfig({
plugins: [remix(), tsconfigPaths()],
});
```
3 changes: 0 additions & 3 deletions packages/remix-dev/vite/node/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ import { Readable } from "node:stream";
import { splitCookiesString } from "set-cookie-parser";
import {
type ServerBuild,
installGlobals,
createReadableStreamFromReadable,
} from "@remix-run/node";
import { createRequestHandler as createBaseRequestHandler } from "@remix-run/server-runtime";

import invariant from "../../invariant";

installGlobals();

function createHeaders(requestHeaders: IncomingHttpHeaders) {
let headers = new Headers();

Expand Down
3 changes: 3 additions & 0 deletions templates/unstable-vite/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { unstable_vitePlugin as remix } from "@remix-run/dev";
import { installGlobals } from "@remix-run/node";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

installGlobals();

export default defineConfig({
plugins: [remix(), tsconfigPaths()],
});
Loading