mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-01 16:30:08 +00:00
* refactor: try esbuild-loader time * refactor: try swc-loader time * refactor: try switch minifiers and disable cache * refactor: try switch minifiers and compress cache * refactor: try switch minifiers and disable cache with swc * refactor: change back to switch minifiers and disable cache with esbuild * chore(deps): update caniuse-lite
31 lines
768 B
JavaScript
31 lines
768 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: false }
|
|
|
|
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,
|
|
}
|
|
},
|
|
}
|
|
}
|