mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-02 16:29:47 +02:00
feat(v2): env variable TERSER_PARALLEL to customize TerserPlugin.parallel (#3497)
* fix(v2): disable terser parallel on CIs Do not run Terser in parallel when using CircleCI or similar CI environments to avoid "Error: Call retries were exceeded" errors. For more information see https://github.com/webpack-contrib/terser-webpack-plugin#parallel `CI=true` is true for: - https://docs.gitlab.com/ee/ci/variables/#debug-logging - https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables - https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables - https://docs.travis-ci.com/user/environment-variables/ * fix(v2): check for possibly undefined env variable * fix(v2): configurable terser parallelization * fix(v2): correct terser codedoc * fix(v2): explicitly test for undefined * fix(v2): add radix to parseInt * fix(v2): add missing semicolon * fix(v2): resolve prettier issues * fix(v2): resolve remaining prettier issues
This commit is contained in:
parent
d3a01458a3
commit
db051eef4f
1 changed files with 12 additions and 1 deletions
|
@ -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,
|
||||
|
@ -103,7 +114,7 @@ export function createBaseConfig(
|
|||
? [
|
||||
new TerserPlugin({
|
||||
cache: true,
|
||||
parallel: true,
|
||||
parallel: terserParallel,
|
||||
sourceMap: false,
|
||||
terserOptions: {
|
||||
parse: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue