-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: #68 * fix: #68 * fix: windows Multi-Pack * Optimization: Reduce file writing * Optimization: code format * fix: support nx monorepo --------- Co-authored-by: 张洪恩 <[email protected]>
- Loading branch information
1 parent
0c81226
commit 1aa30c0
Showing
7 changed files
with
56 additions
and
42 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* https://github.com/module-federation/vite/issues/68 | ||
*/ | ||
import { mkdirSync, writeFileSync } from 'fs'; | ||
import path from 'pathe'; | ||
import { getNormalizeModuleFederationOptions } from './normalizeModuleFederationOptions'; | ||
import { packageNameEncode } from './packageNameUtils'; | ||
|
||
|
||
export function getLocalSharedImportMapPath_windows() { | ||
const { name } = getNormalizeModuleFederationOptions() | ||
return path.resolve(".__mf__win", packageNameEncode(name), "localSharedImportMap") | ||
} | ||
export function writeLocalSharedImportMap_windows(content: string) { | ||
const localSharedImportMapId = getLocalSharedImportMapPath_windows() | ||
createFile(localSharedImportMapId + ".js", "\n// Windows temporarily needs this file, https://github.com/module-federation/vite/issues/68\n" + content) | ||
} | ||
function createFile(filePath: string, content: string) { | ||
const dir = path.dirname(filePath); | ||
|
||
mkdirSync(dir, { recursive: true }); | ||
|
||
writeFileSync(filePath, content); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters