UNPKG

@module-federation/storybook-addon

Version:

Storybook addon to consume remote module federated apps/components

17 lines (15 loc) 627 B
import path from "node:path"; //#region src/utils/correctImportPath.ts const correctImportPath = (context, entryFile) => { if (typeof process !== "undefined") { if (process?.platform !== "win32") return entryFile; if (entryFile.match(/^\.?\.\\/) || !entryFile.match(/^[A-Z]:\\\\/i)) return entryFile.replace(/\\/g, "/"); const relative = path.win32.relative(context, entryFile).replace(/\\/g, "/"); if (relative.includes("node_modules/")) return relative.split("node_modules/")[1]; return `./${relative}`; } return null; }; //#endregion export { correctImportPath }; //# sourceMappingURL=correctImportPath.js.map