Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(v2): env variable TERSER_PARALLEL to customize TerserPlugin.parallel #3497

Merged
merged 9 commits into from
Sep 29, 2020
13 changes: 12 additions & 1 deletion packages/docusaurus/src/webpack/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ export function excludeJS(modulePath: string): boolean {
);
}

// See https://github.com/webpack-contrib/terser-webpack-plugin#parallel
let terserParallel: boolean | number = true;
if (process.env.TERSER_PARALLEL === 'false') {
terserParallel = false;
} else if (
process.env.TERSER_PARALLEL &&
parseInt(process.env.TERSER_PARALLEL, 10) > 0
) {
terserParallel = parseInt(process.env.TERSER_PARALLEL, 10);
}

export function createBaseConfig(
props: Props,
isServer: boolean,
Expand Down Expand Up @@ -103,7 +114,7 @@ export function createBaseConfig(
? [
new TerserPlugin({
cache: true,
parallel: true,
parallel: terserParallel,
sourceMap: false,
terserOptions: {
parse: {
Expand Down