mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-30 18:58:36 +02:00
fix(v2): windows compatibility regression (#2086)
* Revert "perf(v2): replace unnecessary json stringify(string) with inline string (#2039)"
This reverts commit 3aa2ab6ab3
.
* add comment
* Comment bois
This commit is contained in:
parent
4927f764e5
commit
d592e3c470
1 changed files with 6 additions and 2 deletions
|
@ -129,7 +129,8 @@ export async function load(siteDir: string): Promise<Props> {
|
||||||
`export default [\n${clientModules
|
`export default [\n${clientModules
|
||||||
// import() is async so we use require() because client modules can have
|
// import() is async so we use require() because client modules can have
|
||||||
// CSS and the order matters for loading CSS.
|
// CSS and the order matters for loading CSS.
|
||||||
.map(module => ` require("${module}"),`)
|
// We need to JSON.stringify so that if its on windows, backslash are escaped.
|
||||||
|
.map(module => ` require(${JSON.stringify(module)}),`)
|
||||||
.join('\n')}\n];\n`,
|
.join('\n')}\n];\n`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -152,7 +153,10 @@ ${Object.keys(registry)
|
||||||
.sort()
|
.sort()
|
||||||
.map(
|
.map(
|
||||||
key =>
|
key =>
|
||||||
` '${key}': [${registry[key].loader}, "${registry[key].modulePath}", require.resolveWeak("${registry[key].modulePath}")],`,
|
// We need to JSON.stringify so that if its on windows, backslash are escaped.
|
||||||
|
` '${key}': [${registry[key].loader}, ${JSON.stringify(
|
||||||
|
registry[key].modulePath,
|
||||||
|
)}, require.resolveWeak(${JSON.stringify(registry[key].modulePath)})],`,
|
||||||
)
|
)
|
||||||
.join('\n')}};\n`,
|
.join('\n')}};\n`,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue