Attempt to fix vercel edge crash (#5636)

* reverts PR with windows support

* adds windows specific check and return
pull/5576/head^2
Syed Ali Shahbaz 2022-11-22 19:03:17 +05:30 committed by GitHub
parent df91425643
commit 1070cc2892
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 8 deletions

View File

@ -1,7 +1,7 @@
require("dotenv").config({ path: "../../.env" });
const CopyWebpackPlugin = require("copy-webpack-plugin");
const { withSentryConfig } = require("@sentry/nextjs");
const os = require("os");
const withTM = require("next-transpile-modules")([
"@calcom/app-store",
"@calcom/core",
@ -100,13 +100,14 @@ const nextConfig = {
from: "../../packages/app-store/**/static/**",
to({ context, absoluteFilename }) {
// Adds compatibility for windows path
const absoluteFilenameWin = absoluteFilename.replaceAll("\\", "/");
// Adds compatibility for windows path
const normalizedContext = context.replaceAll("\\", "/");
const appName =
/app-store\/(.*)\/static/.exec(absoluteFilename) ||
/app-store\/(.*)\/static/.exec(absoluteFilenameWin);
return Promise.resolve(`${normalizedContext}/public/app-store/${appName[1]}/[name][ext]`);
if (os.platform() === "win32") {
const absoluteFilenameWin = absoluteFilename.replaceAll("\\", "/");
const contextWin = context.replaceAll("\\", "/");
const appName = /app-store\/(.*)\/static/.exec(absoluteFilenameWin);
return Promise.resolve(`${contextWin}/public/app-store/${appName[1]}/[name][ext]`);
}
const appName = /app-store\/(.*)\/static/.exec(absoluteFilename);
return Promise.resolve(`${context}/public/app-store/${appName[1]}/[name][ext]`);
},
},
],