mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-29 15:00:07 +00:00
* Update docusaurus typescript setup for v3 And fix lint-staged and eslint * Enable automatic JSX runtime * Remove babel config and dependencies * update yarn.lock * add typecheck to site workflow * update typedoc config * downgrade docusaurus packages * Update site.yml * Type context and options in webpack-docusaurus-plugin.ts --------- Co-authored-by: Matt Hatcher <3768988+MatthewSH@users.noreply.github.com>
32 lines
878 B
TypeScript
32 lines
878 B
TypeScript
/**
|
|
* Credit: mattrunyon
|
|
* https://github.com/facebook/docusaurus/issues/4765#issuecomment-1679863984
|
|
*/
|
|
|
|
import type { LoadContext, Plugin } from '@docusaurus/types'
|
|
import TerserPlugin, { esbuildMinify } from 'terser-webpack-plugin'
|
|
|
|
export default function (context: LoadContext, options: unknown): Plugin {
|
|
return {
|
|
name: 'webpack-docusaurus-plugin',
|
|
configureWebpack(config, isServer, utils) {
|
|
const cacheOptions = { cache: process.env.CI !== 'true' }
|
|
|
|
const minimizer = new TerserPlugin({
|
|
minify: esbuildMinify,
|
|
})
|
|
const minimizers = config.optimization.minimizer?.map(m =>
|
|
m instanceof TerserPlugin ? minimizer : m,
|
|
)
|
|
|
|
return {
|
|
mergeStrategy: { 'optimization.minimizer': 'replace' },
|
|
optimization: {
|
|
minimizer: minimizers,
|
|
},
|
|
...cacheOptions,
|
|
}
|
|
},
|
|
}
|
|
}
|