From 0d1ea5629b4db1721e6fe755254f446fd105e41f Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Thu, 3 Oct 2024 07:18:03 +0200 Subject: [PATCH] add `nextra/components` to `experimental.optimizePackageImports` --- .changeset/empty-parrots-grow.md | 5 +++++ packages/nextra/src/server/index.ts | 17 +++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 .changeset/empty-parrots-grow.md diff --git a/.changeset/empty-parrots-grow.md b/.changeset/empty-parrots-grow.md new file mode 100644 index 0000000000..436db589ef --- /dev/null +++ b/.changeset/empty-parrots-grow.md @@ -0,0 +1,5 @@ +--- +'nextra': patch +--- + +add `nextra/components` to `experimental.optimizePackageImports` diff --git a/packages/nextra/src/server/index.ts b/packages/nextra/src/server/index.ts index a29c814474..b6d0fb0f4d 100644 --- a/packages/nextra/src/server/index.ts +++ b/packages/nextra/src/server/index.ts @@ -71,18 +71,15 @@ const nextra: Nextra = nextraConfig => { throw new Error('No Nextra theme found!') } - // const optimizedImports = new Set( - // nextConfig.experimental?.optimizePackageImports || [] - // ) - // - // optimizedImports.add('nextra/components') - return { ...nextConfig, - // experimental: { - // ...nextConfig.experimental, - // optimizePackageImports: [...optimizedImports] - // }, + experimental: { + ...nextConfig.experimental, + optimizePackageImports: [ + ...(nextConfig.experimental?.optimizePackageImports || []), + 'nextra/components' + ] + }, ...(nextConfig.output !== 'export' && { rewrites }), env: { ...nextConfig.env,