mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-31 16:00:07 +00:00
* chore: move architecture to new docs * chore: move api reference * chore: faster local build * fix: env
31 lines
788 B
JavaScript
31 lines
788 B
JavaScript
/**
|
|
* Credit: mattrunyon
|
|
* https://github.com/facebook/docusaurus/issues/4765#issuecomment-1679863984
|
|
*/
|
|
|
|
const TerserPlugin = require('terser-webpack-plugin')
|
|
|
|
module.exports = function (context, options) {
|
|
return {
|
|
name: 'webpack-docusaurus-plugin',
|
|
configureWebpack(config, isServer, utils) {
|
|
const cacheOptions = { cache: process.env.CI !== 'true' }
|
|
|
|
const minimizer = new TerserPlugin({
|
|
minify: TerserPlugin.esbuildMinify,
|
|
})
|
|
const minimizers = config.optimization.minimizer?.map(m =>
|
|
m instanceof TerserPlugin ? minimizer : m,
|
|
)
|
|
|
|
return {
|
|
mergeStrategy: { 'optimization.minimizer': 'replace' },
|
|
optimization: {
|
|
minimizer: minimizers,
|
|
},
|
|
...cacheOptions,
|
|
}
|
|
},
|
|
}
|
|
}
|