@netlify/vite-plugin 2.3.6 → 2.3.8
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/dist/main.js +7 -13
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -37,13 +37,15 @@ function netlify(options = {}) {
|
|
|
37
37
|
if (process.env.NETLIFY_DEV) {
|
|
38
38
|
return [];
|
|
39
39
|
}
|
|
40
|
-
let netlifyDev;
|
|
41
40
|
const plugin = {
|
|
42
41
|
name: "vite-plugin-netlify",
|
|
43
42
|
async configureServer(viteDevServer) {
|
|
43
|
+
if (!viteDevServer.httpServer) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
44
46
|
const logger = createLoggerFromViteLogger(viteDevServer.config.logger);
|
|
45
47
|
const { blobs, edgeFunctions, functions, middleware = true, redirects, staticFiles } = options;
|
|
46
|
-
netlifyDev = new NetlifyDev({
|
|
48
|
+
const netlifyDev = new NetlifyDev({
|
|
47
49
|
blobs,
|
|
48
50
|
edgeFunctions,
|
|
49
51
|
functions,
|
|
@@ -57,16 +59,12 @@ function netlify(options = {}) {
|
|
|
57
59
|
projectRoot: viteDevServer.config.root
|
|
58
60
|
});
|
|
59
61
|
await netlifyDev.start();
|
|
62
|
+
viteDevServer.httpServer.once("close", () => {
|
|
63
|
+
netlifyDev.stop();
|
|
64
|
+
});
|
|
60
65
|
logger.log("Environment loaded");
|
|
61
66
|
if (middleware) {
|
|
62
67
|
viteDevServer.middlewares.use(async function netlifyPreMiddleware(nodeReq, nodeRes, next) {
|
|
63
|
-
if (!netlifyDev) {
|
|
64
|
-
logger.error(
|
|
65
|
-
"Some primitives will not work as expected due to an unknown error. Please restart your application."
|
|
66
|
-
);
|
|
67
|
-
next();
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
68
|
const headers = {};
|
|
71
69
|
const result = await netlifyDev.handleAndIntrospectNodeRequest(nodeReq, {
|
|
72
70
|
headersCollector: (key, value) => {
|
|
@@ -91,10 +89,6 @@ function netlify(options = {}) {
|
|
|
91
89
|
`\u{1F4AD} Linking this project to a Netlify site lets you deploy your site, use any environment variables defined on your team and site and much more. Run ${netlifyCommand("npx netlify init")} to get started.`
|
|
92
90
|
);
|
|
93
91
|
}
|
|
94
|
-
},
|
|
95
|
-
async closeBundle() {
|
|
96
|
-
await netlifyDev?.stop();
|
|
97
|
-
netlifyDev = void 0;
|
|
98
92
|
}
|
|
99
93
|
};
|
|
100
94
|
return [plugin];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/vite-plugin",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.8",
|
|
4
4
|
"description": "Vite plugin with a local emulation of the Netlify environment",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"vitest": "^3.0.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@netlify/dev": "4.3.
|
|
39
|
+
"@netlify/dev": "4.3.7",
|
|
40
40
|
"@netlify/dev-utils": "^3.2.2",
|
|
41
41
|
"chalk": "^5.4.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"vite": "^5 || ^6"
|
|
44
|
+
"vite": "^5 || ^6 || ^7"
|
|
45
45
|
}
|
|
46
46
|
}
|