Skip to content

Webpack build hangs with parallel: true #21

Closed
@Pajn

Description

@Pajn
  • Operating System: Windows 10 1810, WSL, Ubuntu 18.04
  • Node Version: 8.12.0
  • NPM Version: 6.4.1
  • webpack Version: 4.19.1
  • terser-webpack-plugin Version: 1.1.0

Expected Behavior

That the webpack build completes

Actual Behavior

The webpack build hangs forever (or at least 30 minutes which is the longest I have lasted) after outputting

Compilation  starting…

However changing parallel: true to parallel: false in terser options will cause the build to complete in normal time (around 40s)

Code

new TerserPlugin({
        terserOptions: {
          parse: {
            // we want terser to parse ecma 8 code. However, we don't want it
            // to apply any minfication steps that turns valid ecma 5 code
            // into invalid ecma 5 code. This is why the 'compress' and 'output'
            // sections only apply transformations that are ecma 5 safe
            // https://github.com/facebook/create-react-app/pull/4234
            ecma: 8
          },
          compress: {
            ecma: 5,
            warnings: false,
            // Disabled because of an issue with Uglify breaking seemingly valid code:
            // https://github.com/facebook/create-react-app/issues/2376
            // Pending further investigation:
            // https://github.com/mishoo/UglifyJS2/issues/2011
            comparisons: false,
            // Disabled because of an issue with Terser breaking valid code:
            // https://github.com/facebook/create-react-app/issues/5250
            // Pending futher investigation:
            // https://github.com/terser-js/terser/issues/120
            inline: 2
          },
          mangle: {
            safari10: true
          },
          output: {
            ecma: 5,
            comments: false,
            // Turned on because emoji and regex is not minified properly using default
            // https://github.com/facebook/create-react-app/issues/2488
            ascii_only: true
          }
        },
        // Use multi-process parallel running to improve the build speed
        // Default number of concurrent runs: os.cpus().length - 1
        parallel: true,
        // Enable file caching
        cache: true,
        sourceMap: shouldUseSourceMap
      })

Full webpack config: https://github.com/Pajn/tscomp/blob/cra2/config/webpack.config.prod.js

How Do We Reproduce?

I suspect this can be related to WSL. If you have some debugging tips I can probably run them.

For the exact same state as I have:

  1. Clone https://github.com/Pajn/tscomp
  2. git checkout terser-bug
  3. Clone https://github.com/Pajn/RAXA
  4. cd RAXA/packages/web
  5. yarn
  6. yarn add --dev path/to/cloned/tscomp/repo
  7. yarn build, or for more information NODE_ENV=production webpack --config node_modules/tscomp/config/webpack.config.prod.js --verbose --info-verbosity verbose --display verbose --profile

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions