-
-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with next.config for static export
- Loading branch information
1 parent
bf6df44
commit 1e2f544
Showing
1 changed file
with
31 additions
and
21 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,33 +1,43 @@ | ||
import nextra from 'nextra' | ||
import { PHASE_EXPORT } from 'next/constants.js' | ||
|
||
const withNextra = nextra({ | ||
theme: 'nextra-theme-docs', | ||
themeConfig: './theme.config.tsx', | ||
latex: true, | ||
flexsearch: { | ||
codeblocks: false | ||
codeblocks: false, | ||
}, | ||
defaultShowCopyCode: true | ||
defaultShowCopyCode: true, | ||
}) | ||
|
||
export default withNextra({ | ||
reactStrictMode: true, | ||
eslint: { | ||
// ESLint behaves weirdly in this monorepo. | ||
ignoreDuringBuilds: true | ||
}, | ||
webpack(config) { | ||
const allowedSvgRegex = /components\/icons\/.+\.svg$/ | ||
export default function (phase) { | ||
return withNextra({ | ||
...(phase === PHASE_EXPORT | ||
? { | ||
images: { | ||
unoptimized: true, | ||
}, | ||
} | ||
: {}), | ||
reactStrictMode: true, | ||
eslint: { | ||
// ESLint behaves weirdly in this monorepo. | ||
ignoreDuringBuilds: true, | ||
}, | ||
webpack(config) { | ||
const allowedSvgRegex = /components\/icons\/.+\.svg$/ | ||
|
||
const fileLoaderRule = config.module.rules.find(rule => | ||
rule.test?.test?.('.svg') | ||
) | ||
fileLoaderRule.exclude = allowedSvgRegex | ||
const fileLoaderRule = config.module.rules.find((rule) => | ||
rule.test?.test?.('.svg') | ||
) | ||
fileLoaderRule.exclude = allowedSvgRegex | ||
|
||
config.module.rules.push({ | ||
test: allowedSvgRegex, | ||
use: ['@svgr/webpack'] | ||
}) | ||
return config | ||
} | ||
}) | ||
config.module.rules.push({ | ||
test: allowedSvgRegex, | ||
use: ['@svgr/webpack'], | ||
}) | ||
return config | ||
}, | ||
}) | ||
} |