From fd142fa0f227feb600f325667f4069dce9b00e98 Mon Sep 17 00:00:00 2001 From: endiliey Date: Sat, 23 Nov 2019 21:41:14 +0700 Subject: [PATCH] perf(v2): replace unnecessary json stringify(string) with inline string --- packages/docusaurus/src/server/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/docusaurus/src/server/index.ts b/packages/docusaurus/src/server/index.ts index cdd591f3fb4a..1a808d8e37e4 100644 --- a/packages/docusaurus/src/server/index.ts +++ b/packages/docusaurus/src/server/index.ts @@ -99,7 +99,7 @@ export async function load(siteDir: string): Promise { `export default [\n${clientModules // import() is async so we use require() because client modules can have // CSS and the order matters for loading CSS. - .map(module => ` require(${JSON.stringify(module)}),`) + .map(module => ` require("${module}"),`) .join('\n')}\n];\n`, ); @@ -119,9 +119,7 @@ ${Object.keys(registry) .sort() .map( key => - ` '${key}': [${registry[key].loader}, ${JSON.stringify( - registry[key].modulePath, - )}, require.resolveWeak(${JSON.stringify(registry[key].modulePath)})],`, + ` '${key}': [${registry[key].loader}, "${registry[key].modulePath}", require.resolveWeak("${registry[key].modulePath}")],`, ) .join('\n')}};\n`, );