From 81ab3349d3ed6ee6060e5203b3c0ab059fb411ac Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Sat, 14 May 2022 16:17:48 +0800 Subject: [PATCH] fix? --- packages/docusaurus/src/server/index.ts | 2 +- packages/docusaurus/src/webpack/base.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/docusaurus/src/server/index.ts b/packages/docusaurus/src/server/index.ts index 3a9213faf100..07b1f18f9f13 100644 --- a/packages/docusaurus/src/server/index.ts +++ b/packages/docusaurus/src/server/index.ts @@ -199,7 +199,7 @@ ${Object.entries(registry) JSON.stringify(routesChunkNames, null, 2), ); - const genRoutes = generate(generatedFilesDir, 'routes.js', routesConfig); + const genRoutes = generate(generatedFilesDir, 'routes.mjs', routesConfig); const genGlobalData = generate( generatedFilesDir, diff --git a/packages/docusaurus/src/webpack/base.ts b/packages/docusaurus/src/webpack/base.ts index 3f45ada64805..51a450991e67 100644 --- a/packages/docusaurus/src/webpack/base.ts +++ b/packages/docusaurus/src/webpack/base.ts @@ -129,6 +129,8 @@ export async function createBaseConfig( '.tsx', '.json', ], + // Allow omitting extension even when the current file is ESM + fullySpecified: false, symlinks: true, // See https://github.com/facebook/docusaurus/issues/3272 roots: [ // Allow resolution of url("/fonts/xyz.ttf") by webpack @@ -205,7 +207,7 @@ export async function createBaseConfig( fileLoaderUtils.rules.svg(), fileLoaderUtils.rules.otherAssets(), { - test: /\.[jt]sx?$/i, + test: /\.[mc]?[jt]sx?$/i, exclude: excludeJS, use: [ getCustomizableJSLoader(siteConfig.webpack?.jsLoader)({