Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,10 @@ export default async function getBaseWebpackConfig(
// @ts-ignore No typings yet
const { MinifyPlugin } =
require('./webpack/plugins/minify-webpack-plugin/src/index.js') as typeof import('./webpack/plugins/minify-webpack-plugin/src')
new MinifyPlugin({ noMangling }).apply(compiler)
new MinifyPlugin({
noMangling,
disableCharFreq: !isClient,
}).apply(compiler)
},
// Minify CSS
(compiler: webpack.Compiler) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ function buildError(error: any, file: string) {
const debugMinify = process.env.NEXT_DEBUG_MINIFY

export class MinifyPlugin {
constructor(private options: { noMangling?: boolean }) {}
constructor(
private options: { noMangling?: boolean; disableCharFreq?: boolean }
) {}

async optimize(
compiler: any,
Expand All @@ -47,7 +49,11 @@ export class MinifyPlugin {
RawSource: typeof sources.RawSource
}
) {
const mangle = !this.options.noMangling
const mangle = this.options.noMangling
? false
: {
disableCharFreq: !!this.options.disableCharFreq,
}
const compilationSpan =
getCompilationSpan(compilation)! || getCompilationSpan(compiler)

Expand Down
Loading