vite-plugin-vercel 0.0.3 → 0.0.4
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/index.js +8 -7
- package/dist/index.mjs +8 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -364,6 +364,7 @@ function vercelPlugin() {
|
|
|
364
364
|
return {
|
|
365
365
|
apply: "build",
|
|
366
366
|
name: "vite-plugin-vercel",
|
|
367
|
+
enforce: "post",
|
|
367
368
|
configResolved(config) {
|
|
368
369
|
resolvedConfig = config;
|
|
369
370
|
},
|
|
@@ -371,16 +372,16 @@ function vercelPlugin() {
|
|
|
371
372
|
if (process.env.VERCEL_ENV === "production" && !process.env.ENABLE_FILE_SYSTEM_API) {
|
|
372
373
|
throw new Error("Missing ENABLE_FILE_SYSTEM_API=1 to your environment variables in your project settings");
|
|
373
374
|
}
|
|
374
|
-
if (resolvedConfig.build.ssr)
|
|
375
|
-
|
|
376
|
-
|
|
375
|
+
if (!resolvedConfig.build.ssr) {
|
|
376
|
+
await cleanOutputDirectory(resolvedConfig);
|
|
377
|
+
} else {
|
|
378
|
+
await copyDistClientToOutputStatic(resolvedConfig);
|
|
379
|
+
}
|
|
377
380
|
},
|
|
378
381
|
async writeBundle() {
|
|
379
382
|
var _a;
|
|
380
|
-
if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr))
|
|
381
|
-
await copyDistClientToOutputStatic(resolvedConfig);
|
|
383
|
+
if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr))
|
|
382
384
|
return;
|
|
383
|
-
}
|
|
384
385
|
const isrPages = await execPrerender(resolvedConfig);
|
|
385
386
|
const fnManifests = await buildApiEndpoints(resolvedConfig);
|
|
386
387
|
await generateFunctionsManifest(resolvedConfig, fnManifests);
|
|
@@ -390,7 +391,7 @@ function vercelPlugin() {
|
|
|
390
391
|
};
|
|
391
392
|
}
|
|
392
393
|
async function copyDistClientToOutputStatic(resolvedConfig) {
|
|
393
|
-
await copyDir(getOutDir(resolvedConfig), getOutput(resolvedConfig, "static"));
|
|
394
|
+
await copyDir(getOutDir(resolvedConfig, "client"), getOutput(resolvedConfig, "static"));
|
|
394
395
|
}
|
|
395
396
|
async function cleanOutputDirectory(resolvedConfig) {
|
|
396
397
|
await import_promises3.default.rm(getOutput(resolvedConfig), {
|
package/dist/index.mjs
CHANGED
|
@@ -335,6 +335,7 @@ function vercelPlugin() {
|
|
|
335
335
|
return {
|
|
336
336
|
apply: "build",
|
|
337
337
|
name: "vite-plugin-vercel",
|
|
338
|
+
enforce: "post",
|
|
338
339
|
configResolved(config) {
|
|
339
340
|
resolvedConfig = config;
|
|
340
341
|
},
|
|
@@ -342,16 +343,16 @@ function vercelPlugin() {
|
|
|
342
343
|
if (process.env.VERCEL_ENV === "production" && !process.env.ENABLE_FILE_SYSTEM_API) {
|
|
343
344
|
throw new Error("Missing ENABLE_FILE_SYSTEM_API=1 to your environment variables in your project settings");
|
|
344
345
|
}
|
|
345
|
-
if (resolvedConfig.build.ssr)
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
if (!resolvedConfig.build.ssr) {
|
|
347
|
+
await cleanOutputDirectory(resolvedConfig);
|
|
348
|
+
} else {
|
|
349
|
+
await copyDistClientToOutputStatic(resolvedConfig);
|
|
350
|
+
}
|
|
348
351
|
},
|
|
349
352
|
async writeBundle() {
|
|
350
353
|
var _a;
|
|
351
|
-
if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr))
|
|
352
|
-
await copyDistClientToOutputStatic(resolvedConfig);
|
|
354
|
+
if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr))
|
|
353
355
|
return;
|
|
354
|
-
}
|
|
355
356
|
const isrPages = await execPrerender(resolvedConfig);
|
|
356
357
|
const fnManifests = await buildApiEndpoints(resolvedConfig);
|
|
357
358
|
await generateFunctionsManifest(resolvedConfig, fnManifests);
|
|
@@ -361,7 +362,7 @@ function vercelPlugin() {
|
|
|
361
362
|
};
|
|
362
363
|
}
|
|
363
364
|
async function copyDistClientToOutputStatic(resolvedConfig) {
|
|
364
|
-
await copyDir(getOutDir(resolvedConfig), getOutput(resolvedConfig, "static"));
|
|
365
|
+
await copyDir(getOutDir(resolvedConfig, "client"), getOutput(resolvedConfig, "static"));
|
|
365
366
|
}
|
|
366
367
|
async function cleanOutputDirectory(resolvedConfig) {
|
|
367
368
|
await fs3.rm(getOutput(resolvedConfig), {
|