TrySound / rollup-plugin-uglify

Rollup plugin to minify generated bundle
MIT License
260 stars 42 forks source link

Plugin doesn't work on Virtual Machines with ubuntu when numWorkers != 1 #53

Closed dumistoklus closed 5 years ago

dumistoklus commented 6 years ago

I tried to build my code on dev machine Windows - it works fine.

Then I tried to build code on VM (VirtualBox) with Ubuntu 16.04 and 18.04 build was stop without any error. Building was stopped on step "./js/article.ts → ./www/build/article.js..."

Step by step I found a heart of bug - "numWorkers". If I set numWorkers to "1" then building work fine. otherwise, stop without error.

TrySound commented 6 years ago

Does it work when numWorkers is not set?

TrySound commented 6 years ago

This is the default value. Is it lying?

import os from 'os';
os.cpus().length - 1
dumistoklus commented 6 years ago

Does it work when numWorkers is not set?

no

This is the default value. Is it lying? import os from 'os'; os.cpus().length - 1

I think it's a problem place. What happens when I have only one CPU?

dumistoklus commented 6 years ago

@TrySound well?

TrySound commented 6 years ago

It's jest bug. Fixed in master. For now you may specify numWorkers explicitly

Math.max(1, os.cpus().length - 1)

Ref https://github.com/facebook/jest/issues/7181

hatashiro commented 5 years ago

So the following workaround fixes this issue.

uglify({ numWorkers: 1 })

I think it's kinda critical, because it doesn't print any error and just silently fails to generate output.

TrySound commented 5 years ago

@utatti You may use rollup-plugin-terser. Terser is less buggy than uglify.

TrySound commented 5 years ago

Guys, I upgraded jest-worker to version which sets minimal numWorkers to 1. You may remove that option now.

I still recommend to migrate to terser.