@netlify/vite-plugin-react-router 3.1.0-next.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.1.0](https://github.com/netlify/remix-compute/compare/vite-plugin-react-router-v3.0.0...vite-plugin-react-router-v3.1.0) (2026-03-13)
4
+
5
+
6
+ ### Features
7
+
8
+ * **vite-plugin-react-router:** support Hydrogen sites ([#641](https://github.com/netlify/remix-compute/issues/641)) ([923d9dc](https://github.com/netlify/remix-compute/commit/923d9dcba02ff6027d85bba697bd6cf1f1d09329))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * actually use Hydrogen entry in dev ([#651](https://github.com/netlify/remix-compute/issues/651)) ([c8f93a2](https://github.com/netlify/remix-compute/commit/c8f93a2d2aeeb95f68d9cc5e2c9b876f8d875aff))
14
+
3
15
  ## [3.0.0](https://github.com/netlify/remix-compute/compare/vite-plugin-react-router-v2.1.3...vite-plugin-react-router-v3.0.0) (2026-02-25)
4
16
 
5
17
 
package/README.md CHANGED
@@ -10,28 +10,33 @@ To deploy a React Router 7+ site to Netlify, install this package:
10
10
  npm install @netlify/vite-plugin-react-router
11
11
  ```
12
12
 
13
- Then include the Netlify plugin in your `vite.config.ts`:
13
+ It's also recommended (but not required) to use the
14
+ [Netlify Vite plugin](https://www.npmjs.com/package/@netlify/vite-plugin), which provides full Netlify platform
15
+ emulation directly in your local dev server:
16
+
17
+ ```sh
18
+ npm install --save-dev @netlify/vite-plugin
19
+ ```
20
+
21
+ and include the Netlify plugin in your `vite.config.ts`:
14
22
 
15
23
  ```typescript
16
24
  import { reactRouter } from '@react-router/dev/vite'
17
25
  import { defineConfig } from 'vite'
18
26
  import tsconfigPaths from 'vite-tsconfig-paths'
19
27
  import netlifyReactRouter from '@netlify/vite-plugin-react-router' // <- add this
28
+ import netlify from '@netlify/vite-plugin' // <- add this (optional)
20
29
 
21
30
  export default defineConfig({
22
31
  plugins: [
23
32
  reactRouter(),
24
33
  tsconfigPaths(),
25
34
  netlifyReactRouter(), // <- add this
35
+ netlify(), // <- add this (optional)
26
36
  ],
27
37
  })
28
38
  ```
29
39
 
30
- > [!NOTE]
31
- >
32
- > This plugin automatically includes [`@netlify/vite-plugin`](https://npmx.dev/@netlify/vite-plugin), which provides
33
- > full Netlify platform emulation directly in your local dev server.
34
-
35
40
  Your app is ready to [deploy to Netlify](https://docs.netlify.com/deploy/create-deploys/).
36
41
 
37
42
  ### Deploying to Edge Functions
@@ -48,6 +53,7 @@ export default defineConfig({
48
53
  reactRouter(),
49
54
  tsconfigPaths(),
50
55
  netlifyReactRouter({ edge: true }), // <- deploy to Edge Functions
56
+ netlify(),
51
57
  ],
52
58
  })
53
59
  ```
@@ -82,6 +88,7 @@ export default defineConfig({
82
88
  edge: true,
83
89
  excludedPaths: ['/ping', '/api/*', '/webhooks/*'],
84
90
  }),
91
+ netlify(),
85
92
  ],
86
93
  })
87
94
  ```
@@ -152,6 +159,12 @@ export default function Example() {
152
159
  }
153
160
  ```
154
161
 
162
+ > [!IMPORTANT]
163
+ >
164
+ > Note that in local development, `netlifyRouterContext` requires Netlify platform emulation, which is provided
165
+ > seamlessly by [`@netlify/vite-plugin`](https://www.npmjs.com/package/@netlify/vite-plugin) (or Netlify CLI - up to
166
+ > you).
167
+
155
168
  ### Middleware context
156
169
 
157
170
  React Router introduced a stable middleware feature in 7.9.0.
@@ -180,3 +193,9 @@ export default function Home() {
180
193
  return <h1>Hello world</h1>
181
194
  }
182
195
  ```
196
+
197
+ > [!IMPORTANT]
198
+ >
199
+ > Note that in local development, `netlifyRouterContext` requires Netlify platform emulation, which is provided
200
+ > seamlessly by [`@netlify/vite-plugin`](https://www.npmjs.com/package/@netlify/vite-plugin) (or Netlify CLI - up to
201
+ > you).
package/dist/index.d.mts CHANGED
@@ -21,6 +21,6 @@ interface NetlifyPluginOptions {
21
21
  */
22
22
  excludedPaths?: string[];
23
23
  }
24
- declare function netlifyPlugin(options?: NetlifyPluginOptions): Plugin[];
24
+ declare function netlifyPlugin(options?: NetlifyPluginOptions): Plugin;
25
25
 
26
26
  export { netlifyPlugin as default };
package/dist/index.d.ts CHANGED
@@ -60,6 +60,6 @@ interface NetlifyPluginOptions {
60
60
  */
61
61
  excludedPaths?: string[];
62
62
  }
63
- declare function netlifyPlugin(options?: NetlifyPluginOptions): Plugin[];
63
+ declare function netlifyPlugin(options?: NetlifyPluginOptions): Plugin;
64
64
 
65
65
  export { type GetLoadContextFunction, type RequestHandler, createRequestHandler, netlifyPlugin as default, netlifyRouterContext };
package/dist/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name2 in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/index.ts
@@ -119,13 +109,12 @@ function createRequestHandler({
119
109
  var import_promises = require("fs/promises");
120
110
  var import_node_path2 = require("path");
121
111
  var import_posix = require("path/posix");
122
- var import_vite_plugin = __toESM(require("@netlify/vite-plugin"));
123
112
  var import_node_fetch_server = require("@remix-run/node-fetch-server");
124
113
  var import_tinyglobby = require("tinyglobby");
125
114
 
126
115
  // package.json
127
116
  var name = "@netlify/vite-plugin-react-router";
128
- var version = "3.1.0-next.2";
117
+ var version = "3.1.0";
129
118
 
130
119
  // src/lib/rollup.ts
131
120
  var import_node_path = require("path");
@@ -241,7 +230,7 @@ function netlifyPlugin(options = {}) {
241
230
  let currentCommand;
242
231
  let isHydrogenSite = false;
243
232
  let userServerFile;
244
- const reactRouterPlugin = {
233
+ return {
245
234
  name: "vite-plugin-netlify-react-router",
246
235
  config(_config, { command, isSsrBuild }) {
247
236
  currentCommand = command;
@@ -389,7 +378,6 @@ function netlifyPlugin(options = {}) {
389
378
  }
390
379
  }
391
380
  };
392
- return [reactRouterPlugin, ...(0, import_vite_plugin.default)()];
393
381
  }
394
382
  // Annotate the CommonJS export names for ESM import in node:
395
383
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -8,13 +8,12 @@ import "./chunk-J5PMA2AP.mjs";
8
8
  import { access, mkdir, writeFile } from "node:fs/promises";
9
9
  import { dirname, join, relative, resolve, sep } from "node:path";
10
10
  import { sep as posixSep } from "node:path/posix";
11
- import netlifyVitePlugin from "@netlify/vite-plugin";
12
11
  import { createRequest, sendResponse } from "@remix-run/node-fetch-server";
13
12
  import { glob } from "tinyglobby";
14
13
 
15
14
  // package.json
16
15
  var name = "@netlify/vite-plugin-react-router";
17
- var version = "3.1.0-next.2";
16
+ var version = "3.1.0";
18
17
 
19
18
  // src/lib/rollup.ts
20
19
  import { basename, extname } from "node:path";
@@ -130,7 +129,7 @@ function netlifyPlugin(options = {}) {
130
129
  let currentCommand;
131
130
  let isHydrogenSite = false;
132
131
  let userServerFile;
133
- const reactRouterPlugin = {
132
+ return {
134
133
  name: "vite-plugin-netlify-react-router",
135
134
  config(_config, { command, isSsrBuild }) {
136
135
  currentCommand = command;
@@ -278,7 +277,6 @@ function netlifyPlugin(options = {}) {
278
277
  }
279
278
  }
280
279
  };
281
- return [reactRouterPlugin, ...netlifyVitePlugin()];
282
280
  }
283
281
  export {
284
282
  createRequestHandler,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/vite-plugin-react-router",
3
- "version": "3.1.0-next.2",
3
+ "version": "3.1.0",
4
4
  "description": "React Router 7+ Vite plugin for Netlify",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",
@@ -54,7 +54,6 @@
54
54
  "dependencies": {
55
55
  "@netlify/edge-functions": "^3.0.4",
56
56
  "@netlify/functions": "^5.1.3",
57
- "@netlify/vite-plugin": "^2.11.0",
58
57
  "@remix-run/node-fetch-server": "^0.9.0",
59
58
  "isbot": "^5.1.25",
60
59
  "tinyglobby": "^0.2.10"