Skip to content

Commit

Permalink
Fix issue with next.config for static export
Browse files Browse the repository at this point in the history
  • Loading branch information
elrumordelaluz committed Nov 8, 2023
1 parent bf6df44 commit 1e2f544
Showing 1 changed file with 31 additions and 21 deletions.
52 changes: 31 additions & 21 deletions apps/docs/next.config.mjs
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
},
})
}

0 comments on commit 1e2f544

Please sign in to comment.