Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import { resolve } from "node:path";
//#region src/normalize-webpack-path.ts
function getWebpackPath(compiler, options = { framework: "other" }) {
const resolveWithContext = new Function("id", "options", "return typeof require === \"undefined\" ? \"\" : require.resolve(id, options)");
try {
compiler.webpack();
return "";
} catch (err) {
const webpackPath = ((err.stack?.split("\n") || []).find((item) => item.includes("at webpack")) || "").replace(/[^\(\)]+/, "").slice(1, -1).split(":").slice(0, -2).join(":");
if (options?.framework === "nextjs") {
if (webpackPath.endsWith("webpack.js")) return webpackPath.replace("webpack.js", "index.js");
return "";
}
return resolveWithContext("webpack", { paths: [webpackPath] });
}
}
const normalizeWebpackPath = (fullPath) => {
if (fullPath === "webpack") return process.env["FEDERATION_WEBPACK_PATH"] || fullPath;
if (process.env["FEDERATION_WEBPACK_PATH"]) return resolve(process.env["FEDERATION_WEBPACK_PATH"], fullPath.replace("webpack", "../../"));
return fullPath;
};
//#endregion
export { getWebpackPath, normalizeWebpackPath };
//# sourceMappingURL=normalize-webpack-path.js.map