mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-21 02:40:08 +00:00
* Migrate eslint and prettier to biomejs This does NOT include examples/bigbot as it has its own formatter * Update to biome 1.8.0 * Readd dotenv dev dependency to rest During a merge it got lost
30 lines
870 B
TypeScript
30 lines
870 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,
|
|
}
|
|
},
|
|
}
|
|
}
|