Adds windows compatibility for copywebpackplugin (#5602)

* adds windows compatibility

* Revert unintentional change
pull/5614/head
Syed Ali Shahbaz 2022-11-21 20:03:19 +05:30 committed by GitHub
parent 91274d8ee0
commit 196549c124
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -99,8 +99,14 @@ const nextConfig = {
{ {
from: "../../packages/app-store/**/static/**", from: "../../packages/app-store/**/static/**",
to({ context, absoluteFilename }) { to({ context, absoluteFilename }) {
const appName = /app-store\/(.*)\/static/.exec(absoluteFilename); // Adds compatibility for windows path
return Promise.resolve(`${context}/public/app-store/${appName[1]}/[name][ext]`); 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]`);
}, },
}, },
], ],