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

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/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,12 +109,11 @@ 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_tinyglobby = require("tinyglobby");
124
113
 
125
114
  // package.json
126
115
  var name = "@netlify/vite-plugin-react-router";
127
- var version = "3.1.0-next.0";
116
+ var version = "3.1.0-next.1";
128
117
 
129
118
  // src/lib/rollup.ts
130
119
  var import_node_path = require("path");
@@ -239,7 +228,7 @@ function netlifyPlugin(options = {}) {
239
228
  let isProductionSsrBuild = false;
240
229
  let currentCommand;
241
230
  let isHydrogenSite = false;
242
- const reactRouterPlugin = {
231
+ return {
243
232
  name: "vite-plugin-netlify-react-router",
244
233
  config(_config, { command, isSsrBuild }) {
245
234
  currentCommand = command;
@@ -349,7 +338,6 @@ function netlifyPlugin(options = {}) {
349
338
  }
350
339
  }
351
340
  };
352
- return [reactRouterPlugin, ...(0, import_vite_plugin.default)()];
353
341
  }
354
342
  // Annotate the CommonJS export names for ESM import in node:
355
343
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -8,12 +8,11 @@ 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 { glob } from "tinyglobby";
13
12
 
14
13
  // package.json
15
14
  var name = "@netlify/vite-plugin-react-router";
16
- var version = "3.1.0-next.0";
15
+ var version = "3.1.0-next.1";
17
16
 
18
17
  // src/lib/rollup.ts
19
18
  import { basename, extname } from "node:path";
@@ -128,7 +127,7 @@ function netlifyPlugin(options = {}) {
128
127
  let isProductionSsrBuild = false;
129
128
  let currentCommand;
130
129
  let isHydrogenSite = false;
131
- const reactRouterPlugin = {
130
+ return {
132
131
  name: "vite-plugin-netlify-react-router",
133
132
  config(_config, { command, isSsrBuild }) {
134
133
  currentCommand = command;
@@ -238,7 +237,6 @@ function netlifyPlugin(options = {}) {
238
237
  }
239
238
  }
240
239
  };
241
- return [reactRouterPlugin, ...netlifyVitePlugin()];
242
240
  }
243
241
  export {
244
242
  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.0",
3
+ "version": "3.1.0-next.1",
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.10.11",
58
57
  "isbot": "^5.1.25",
59
58
  "tinyglobby": "^0.2.10"
60
59
  },