@netlify/vite-plugin-react-router 0.0.0 → 1.0.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/CHANGELOG.md +16 -0
- package/README.md +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +22 -22
- package/dist/index.mjs +19 -19
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.0.1](https://github.com/netlify/remix-compute/compare/vite-plugin-react-router-v1.0.0...vite-plugin-react-router-v1.0.1) (2025-04-04)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **deps:** support and test against Vite 6 ([#507](https://github.com/netlify/remix-compute/issues/507)) ([58c378a](https://github.com/netlify/remix-compute/commit/58c378ac6e1a723300f240756c1e26e577b00d44))
|
|
9
|
+
|
|
10
|
+
## 1.0.0 (2024-12-13)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add @netlify/vite-plugin-react-router to support React Router 7 ([#472](https://github.com/netlify/remix-compute/issues/472)) ([aeeb979](https://github.com/netlify/remix-compute/commit/aeeb9792887838767d3ebd6f2e6bd05d4a379f4e))
|
|
16
|
+
|
|
17
|
+
## Changelog
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ To deploy a React Router 7+ site to Netlify, install this package:
|
|
|
8
8
|
## How to use
|
|
9
9
|
|
|
10
10
|
```sh
|
|
11
|
-
npm install @netlify/vite-plugin-react-router
|
|
11
|
+
npm install --save-dev @netlify/vite-plugin-react-router
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
and include the Netlify plugin in your `vite.config.ts`:
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -18,12 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
createRequestHandler: () => createRequestHandler,
|
|
24
24
|
default: () => netlifyPlugin
|
|
25
25
|
});
|
|
26
|
-
module.exports = __toCommonJS(
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
27
|
|
|
28
28
|
// src/server.ts
|
|
29
29
|
var import_react_router = require("react-router");
|
|
@@ -56,10 +56,10 @@ var import_posix = require("path/posix");
|
|
|
56
56
|
|
|
57
57
|
// package.json
|
|
58
58
|
var name = "@netlify/vite-plugin-react-router";
|
|
59
|
-
var version = "
|
|
59
|
+
var version = "1.0.1";
|
|
60
60
|
|
|
61
61
|
// src/plugin.ts
|
|
62
|
-
var NETLIFY_FUNCTIONS_DIR = ".netlify/functions
|
|
62
|
+
var NETLIFY_FUNCTIONS_DIR = ".netlify/v1/functions";
|
|
63
63
|
var FUNCTION_FILENAME = "react-router-server.mjs";
|
|
64
64
|
var FUNCTION_HANDLER_CHUNK = "server";
|
|
65
65
|
var FUNCTION_HANDLER_MODULE_ID = "virtual:netlify-server";
|
|
@@ -93,25 +93,25 @@ function generateNetlifyFunction(handlerPath) {
|
|
|
93
93
|
}
|
|
94
94
|
function netlifyPlugin() {
|
|
95
95
|
let resolvedConfig;
|
|
96
|
-
let
|
|
97
|
-
let isSsr;
|
|
96
|
+
let isProductionSsrBuild = false;
|
|
98
97
|
return {
|
|
99
|
-
name: "vite-plugin-react-router
|
|
98
|
+
name: "vite-plugin-netlify-react-router",
|
|
100
99
|
config(config, { command, isSsrBuild }) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
100
|
+
isProductionSsrBuild = isSsrBuild === true && command === "build";
|
|
101
|
+
if (isProductionSsrBuild) {
|
|
102
|
+
config.build ??= {};
|
|
103
|
+
config.build.rollupOptions ??= {};
|
|
104
|
+
config.build.rollupOptions.input = {
|
|
105
|
+
[FUNCTION_HANDLER_CHUNK]: FUNCTION_HANDLER_MODULE_ID
|
|
106
|
+
};
|
|
107
|
+
config.build.rollupOptions.output ??= {};
|
|
108
|
+
if (Array.isArray(config.build.rollupOptions.output)) {
|
|
109
|
+
console.warn(
|
|
110
|
+
"Expected Vite config `build.rollupOptions.output` to be an object, but it is an array - overwriting it, but this may cause issues with your custom configuration"
|
|
111
|
+
);
|
|
112
|
+
config.build.rollupOptions.output = {};
|
|
114
113
|
}
|
|
114
|
+
config.build.rollupOptions.output.entryFileNames = "[name].js";
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
117
|
async resolveId(source) {
|
|
@@ -130,7 +130,7 @@ function netlifyPlugin() {
|
|
|
130
130
|
},
|
|
131
131
|
// See https://rollupjs.org/plugin-development/#writebundle.
|
|
132
132
|
async writeBundle() {
|
|
133
|
-
if (
|
|
133
|
+
if (isProductionSsrBuild) {
|
|
134
134
|
const functionsDirectory = (0, import_node_path.join)(resolvedConfig.root, NETLIFY_FUNCTIONS_DIR);
|
|
135
135
|
await (0, import_promises.mkdir)(functionsDirectory, { recursive: true });
|
|
136
136
|
const handlerPath = (0, import_node_path.join)(resolvedConfig.build.outDir, `${FUNCTION_HANDLER_CHUNK}.js`);
|
package/dist/index.mjs
CHANGED
|
@@ -29,10 +29,10 @@ import { sep as posixSep } from "node:path/posix";
|
|
|
29
29
|
|
|
30
30
|
// package.json
|
|
31
31
|
var name = "@netlify/vite-plugin-react-router";
|
|
32
|
-
var version = "
|
|
32
|
+
var version = "1.0.1";
|
|
33
33
|
|
|
34
34
|
// src/plugin.ts
|
|
35
|
-
var NETLIFY_FUNCTIONS_DIR = ".netlify/functions
|
|
35
|
+
var NETLIFY_FUNCTIONS_DIR = ".netlify/v1/functions";
|
|
36
36
|
var FUNCTION_FILENAME = "react-router-server.mjs";
|
|
37
37
|
var FUNCTION_HANDLER_CHUNK = "server";
|
|
38
38
|
var FUNCTION_HANDLER_MODULE_ID = "virtual:netlify-server";
|
|
@@ -66,25 +66,25 @@ function generateNetlifyFunction(handlerPath) {
|
|
|
66
66
|
}
|
|
67
67
|
function netlifyPlugin() {
|
|
68
68
|
let resolvedConfig;
|
|
69
|
-
let
|
|
70
|
-
let isSsr;
|
|
69
|
+
let isProductionSsrBuild = false;
|
|
71
70
|
return {
|
|
72
|
-
name: "vite-plugin-react-router
|
|
71
|
+
name: "vite-plugin-netlify-react-router",
|
|
73
72
|
config(config, { command, isSsrBuild }) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
73
|
+
isProductionSsrBuild = isSsrBuild === true && command === "build";
|
|
74
|
+
if (isProductionSsrBuild) {
|
|
75
|
+
config.build ??= {};
|
|
76
|
+
config.build.rollupOptions ??= {};
|
|
77
|
+
config.build.rollupOptions.input = {
|
|
78
|
+
[FUNCTION_HANDLER_CHUNK]: FUNCTION_HANDLER_MODULE_ID
|
|
79
|
+
};
|
|
80
|
+
config.build.rollupOptions.output ??= {};
|
|
81
|
+
if (Array.isArray(config.build.rollupOptions.output)) {
|
|
82
|
+
console.warn(
|
|
83
|
+
"Expected Vite config `build.rollupOptions.output` to be an object, but it is an array - overwriting it, but this may cause issues with your custom configuration"
|
|
84
|
+
);
|
|
85
|
+
config.build.rollupOptions.output = {};
|
|
87
86
|
}
|
|
87
|
+
config.build.rollupOptions.output.entryFileNames = "[name].js";
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
90
|
async resolveId(source) {
|
|
@@ -103,7 +103,7 @@ function netlifyPlugin() {
|
|
|
103
103
|
},
|
|
104
104
|
// See https://rollupjs.org/plugin-development/#writebundle.
|
|
105
105
|
async writeBundle() {
|
|
106
|
-
if (
|
|
106
|
+
if (isProductionSsrBuild) {
|
|
107
107
|
const functionsDirectory = join(resolvedConfig.root, NETLIFY_FUNCTIONS_DIR);
|
|
108
108
|
await mkdir(functionsDirectory, { recursive: true });
|
|
109
109
|
const handlerPath = join(resolvedConfig.build.outDir, `${FUNCTION_HANDLER_CHUNK}.js`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/vite-plugin-react-router",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "React Router 7+ Vite plugin for Netlify",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"react-router": "^7.0.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@netlify/functions": "^
|
|
48
|
+
"@netlify/functions": "^3.0.0",
|
|
49
49
|
"@types/react": "^18.0.27",
|
|
50
50
|
"@types/react-dom": "^18.0.10",
|
|
51
51
|
"react": "^18.2.0",
|
|
52
52
|
"react-dom": "^18.2.0",
|
|
53
53
|
"tsup": "^8.0.2",
|
|
54
|
-
"vite": "^
|
|
54
|
+
"vite": "^6.2.5"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"vite": ">=5.0.0"
|