Giter VIP home page Giter VIP logo

rollup-plugin-terser's Introduction

rollup-plugin-terser Travis Build Status

Rollup plugin to minify generated es bundle. Uses terser under the hood.

Install

yarn add rollup-plugin-terser --dev
# Or with npm:
npm i rollup-plugin-terser --save-dev

Note: this package requires [email protected] and higher (including [email protected])

Usage

import { rollup } from "rollup";
import { terser } from "rollup-plugin-terser";

rollup({
  input: "main.js",
  plugins: [terser()],
});

Why named export?

  1. Module is a namespace. Default export often leads to function/component per file dogma and makes code less maintainable.
  2. Interop with commonjs is broken in many cases or hard to maintain.
  3. Show me any good language with default exports. It's historical javascriptism.

Options

⚠️ Caveat: any function used in options object cannot rely on its surrounding scope, since it is executed in an isolated context.

terser(options);

options - terser API options

Note: some terser options are set by the plugin automatically:

  • module: true is set when format is esm or es
  • toplevel: true is set when format is cjs

options.numWorkers: number

Amount of workers to spawn. Defaults to the number of CPUs minus 1.

Examples

Using as output plugin

// rollup.config.js
import { terser } from "rollup-plugin-terser";

export default {
  input: "index.js",
  output: [
    { file: "lib.js", format: "cjs" },
    { file: "lib.min.js", format: "cjs", plugins: [terser()] },
    { file: "lib.esm.js", format: "esm" },
  ],
};

Comments

If you'd like to preserve comments (for licensing for example), then you can specify a function to do this like so:

terser({
  format: {
    comments: function (node, comment) {
      var text = comment.value;
      var type = comment.type;
      if (type == "comment2") {
        // multiline comment
        return /@preserve|@license|@cc_on/i.test(text);
      }
    },
  },
});

Alternatively, you can also choose to keep all comments (e.g. if a licensing header has already been prepended by a previous rollup plugin):

terser({
  format: {
    comments: "all",
  },
});

See Terser documentation for further reference.

License

MIT © Bogdan Chadkin

rollup-plugin-terser's People

Contributors

andarist avatar bennypowers avatar chicoxyzzy avatar developit avatar edsrzf avatar evs-chris avatar franciscop avatar lukeed avatar notwoods avatar thw0rted avatar trysound avatar willfarrell avatar yisraelx avatar zech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rollup-plugin-terser's Issues

Unexpected token =>

[!] (terser plugin) SyntaxError: Unexpected token =>
SyntaxError: Unexpected token =>
    at Object.transform (/home/bjorn/code/septima-search/node_modules/rollup-plugin-terser/transform.js:4:24)
    at execFunction (/home/bjorn/code/septima-search/node_modules/jest-worker/build/workers/processChild.js:133:17)
    at execHelper (/home/bjorn/code/septima-search/node_modules/jest-worker/build/workers/processChild.js:117:5)
    at execMethod (/home/bjorn/code/septima-search/node_modules/jest-worker/build/workers/processChild.js:121:5)
    at process.on.request (/home/bjorn/code/septima-search/node_modules/jest-worker/build/workers/processChild.js:40:7)
    at emitTwo (events.js:126:13)
    at process.emit (events.js:214:7)
    at emit (internal/child_process.js:762:12)
    at _combinedTickCallback (internal/process/next_tick.js:142:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)

The above output is from Node v8.15.0 on Ubuntu 18.04 LTS with rollup-plugin-terser 4.0.2. If I downgrade to 3.0.0 I do not get this issue.

Issue with regex

Have this string

var spaces = "\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029";

terser plugins makes it exactly

var e="\t\n\v\f\r   ᠎              \u2028\u2029"

Cannot create a minified bundle

I was trying to move from using the terser package directly on my rollup bundles to using this plugin. I remember that in the past it used to work for me but now it does not work if I want to use the plugin.

My rollup.config.js is:

import { terser } from 'rollup-plugin-terser'

const output = {
  format: 'iife',
  dir: 'build',
  sourcemap: true
}

if (process.env.BUILD === 'production') {
  output.file = 'bundle.min.js'
} else {
  output.file = 'bundle.js'
}

const plugins = []

if (process.env.BUILD === 'production') {
  plugins.push(terser())
}

const watch = {
  include: 'src/**'
}

export default {
  input: 'src/index.js',
  output,
  plugins,
  watch
}

I get the following output when I run the rollup --config --environment BUILD:production:

> rollup --config --environment BUILD:production

src/index.js → bundle.min.js...
[!] (terser plugin) TypeError: Cannot read property 'transform' of undefined
TypeError: Cannot read property 'transform' of undefined
    at Object.renderChunk[...]

Any ideas?

[!] (terser plugin) Error: Farm is ended, no more calls can be done to it

I keep receiving the above error when running rollup -c. It looks like the error derives from jest:

[!] (terser plugin) Error: Farm is ended, no more calls can be done to it
Error: Farm is ended, no more calls can be done to it
    at exports.default.end (/home/hyde/Projects/Libraries/node-gitlab/node_modules/jest-worker/build/index.js:166:13)
    at Object.generateBundle (/home/hyde/Projects/Libraries/node-gitlab/node_modules/rollup-plugin-terser/index.js:38:19)
    at /home/hyde/Projects/Libraries/node-gitlab/node_modules/rollup/dist/rollup.js:20847:25
    at process._tickCallback (internal/process/next_tick.js:68:7)

Here is my config:

import ts from 'rollup-plugin-typescript2';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import json from 'rollup-plugin-json';
import { terser } from "rollup-plugin-terser";
import typescript from 'typescript';
import pkg from './package.json';

export default [
  {
    input: 'src/index.ts',
    output: [
      { file: pkg.module, format: 'esm' }
    ],
    external: [...Object.keys(pkg.dependencies || {})],
    plugins: [
      json(),
      ts({
        typescript,
      }),
      terser(),
    ],
  },
];

packages:

  "dependencies": {
    "form-data": "^2.3.3",
    "got": "^9.2.2",
    "humps": "^2.0.1",
    "ky": "^0.4.1",
    "randomstring": "^1.1.5"
  },

and tsconfig:

{
  "compilerOptions": {
    "declaration": false,
   
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noImplicitAny": false,

    "strictPropertyInitialization": true,
    "strictNullChecks": true,

    "target": "es5",
    "module": "es6",
    "outDir": "dist",
    "pretty": true,
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

The problem seems to only occur when attempting to compile an es module. If i make a cjs one it works fine. Any suggestions?

Add a default export

All rollup plugins except yours are using default exports. Terser plugin import is driving me and my co-workers nuts.

Please add a default export.

Plugin breaks named functions declared as variable

Input:

import xy from 'foo'

var a = function a() {
  a()
}

xy()
export { a }

Output:

import o from"foo";var r=function o(){o()};o();export{r as a};

Expected output:

import o from"foo";var r=function r(){r()};o();export{r as a};

The name of the function and the recursive call are renamed incorrectly. Note that this error only occurs when there are imports and exports.

The rollup.config I use:

import {terser} from "rollup-plugin-terser"

export default [
  {
    input: 'test.js',
    output: {
      file: "test-out.js",
      format: 'esm'
    },
    external: ["foo"],
    plugins: [terser()],
    treeshake: false
  }
];

I'm not entirely sure if this is a bug of this plugin, rollup or terser. The outputs of of rollup without this plugin or terser without rollup are correct, though.

Allow excluding based on chunk name

In my rollup build I have a large prebuilt chunk, which I separate using manualChunks. I'd like to be able to exclude this chunk from terser, but unfortunately I can't because terser exclude option acts on the fileName property. This is is the hashed named, which I don't know and can't match on.

I'd like to propose terser to exclude based on the name field, so that you can exclude based on the actual chunk name. See rollup/rollup#3497 for context.

Terser doesn't mangle or optimize when format is esm

It seems that mangling is broken when output.format is esm (or es). Here's a repro:

"scripts": {
  "build": "rollup -c"
}
// rollup.config.js
import { terser } from 'rollup-plugin-terser'

const production = !process.env.ROLLUP_WATCH

export default {
  input: 'src/index.js',
  output: {
    file: 'dist/bundle.js',
    format: 'esm'
  },
  plugins: [
    production && terser()
  ]
}
// src/index.js
class Logger {
  log (...strings) {
    console.log(strings)
  }
}

const now = new Date()
const year = now.getFullYear()
const month = now.getMonth() + 1
const date = now.getDate()

const logger = new Logger()

logger.log(year, month, date)

When the format is esm, I get

// dist/bundle.js
class Logger{log(...e){console.log(e)}}const now=new Date,year=now.getFullYear(),month=now.getMonth()+1,date=now.getDate(),logger=new Logger;logger.log(year,month,date);

But when format is changed to iife

!function(){"use strict";const e=new Date,t=e.getFullYear(),o=e.getMonth()+1,l=e.getDate();(new class{log(...e){console.log(e)}}).log(t,o,l)}();

Note that in esm

  • it doesn't optimize to an anonymous class
  • it doesn't obfuscate most identifiers, like Logger class and now, date, etc. vars

Am I missing something, or this a known limitation or bug? Thanks.

  • node -v: v11.2.0
  • npm -v: 6.4.1
  • rollup -v: v0.67.3

Terser fails with ES6 syntax configuration for "comments"

Hi,

I just noticed that terser (or the submodule "serialize-javascript") fails if you use a configuration definition with ES6 syntax for method shorthands like this:

{
    "mangle": true,
    "compress": false,
    "output": {
        comments(node, comment) {
            if (comment.type === "comment2") {
                // multiline comment
                return /@preserve|@license|@cc_on|^!/i.test(comment.value);
            }
            return false;
        },
        "preamble": `/*! ${name} - v${version} - ${date} - http://some-domain.com */`
    }
}

if you define it with arrow functions:

{
    "mangle": true,
    "compress": false,
    "output": {
        "comments": (node, comment) => {
            if (comment.type === "comment2") {
                // multiline comment
                return /@preserve|@license|@cc_on|^!/i.test(comment.value);
            }
            return false;
        },
        "preamble": `/*! ${name} - v${version} - ${date} - http://some-domain.com */`
    }
}

or the old fashioned way:

{
    "mangle": true,
    "compress": false,
    "output": {
        "comments": function (node, comment) {
            if (comment.type === "comment2") {
                // multiline comment
                return /@preserve|@license|@cc_on|^!/i.test(comment.value);
            }
            return false;
        },
        "preamble": `/*! ${name} - v${version} - ${date} - http://some-domain.com */`
    }
}

everything is okay.

Maybe this is a "Won't fix" kind of issue. But I just wanted to mention it. Maybe there is another serializer out there handling it better.

:-)

Update dependency to Terser 4

Terser 4 was recently released, it seems there's just a "simple" breaking change so it should be safe to upgrade to.

treeshake.pureExternalModules not run after terser minification.

When used with treeshake.pureExternalModules, essentially all unused imports after terser minification should be removed. But I guess that happens before the minification and thus persists.

Minimal reproducing case: https://repl.it/repls/SoupyWigglyExtraction
Here it should not log anything. (The last line of index.js)

This might not be a bug with rollup-plugin-terser or rollup or terser individually per se, but maybe if we can change the order this might work.

Related: terser/terser#168 which might require some effort if tackled only from terser's side.

rollup 1.0.0 release

Looks like rollup version 1.0.0 was released. This library currently requires rollup < 1.0.0

Serialization now prevents use of nameCache option

Hi there! Terser's nameCache option allows specifying an object to use for consistently mangling names. One useful detail of this API is that the object is mutated in-place, which means it's possible to store the object after Terser runs and preserve names across compilations.

We have been using this in microbundle to populate newly mangled property names in a mangle.json file after compilation so that developers notice them when committing and have a chance to correct the generated names.

Now that rollup-plugin-terser offloads Terser to a worker via jest-worker, the nameCache object gets serialized and passed back to the worker, which means it no longer gets updated in-place.

Plugin silently sabotages its work

The plugin works fine at my home pc with Ubuntu 18.03, but it silently sabotages its work on our production server with Debian. The problem is that it does start working but creates no target file, and no plugin after it in the pipeline starts doing its job, but rollup returns code 0 as if everything were fine. As I could not figure out the cause of a problem, I tried to switch to other minification plugins. It finds out that rollup-plugin-terser and rollup-plugin-uglify behave the same way (work in one environment and do not work in the other one), but rollup-plugin-babel-minify works pretty well in the both environments. Unfortunately I can't give any more information except that insufficient, but maybe could it suggest some debugging idea to you.

Add top-level await support

const f = async (): Promise<void> => {
	console.log('TEST')
}

await f()

export {}

With my rollup config it compiles into:

const f = async () => {
    console.log('TEST');
};
await f();

But using rollup-plugin-terser i getting:

[!] (plugin terser) SyntaxError: Unexpected await identifier inside strict mode SyntaxError: Unexpected await identifier inside strict mode

My rollup config:

import resolve from '@rollup/plugin-node-resolve'
import typescript from 'rollup-plugin-typescript2'
import { terser } from 'rollup-plugin-terser'
import run from '@rollup/plugin-run'

import buildins from 'builtin-modules'
import { dependencies } from './package.json'

const production = !process.env.ROLLUP_WATCH

export default {
	input: './src/index.ts',
	output: {
		file: 'app.js',
		format: 'esm',
	},

	external: [...buildins, ...Object.keys(dependencies)],

	plugins: [
		production && resolve({ preferBuiltins: true }),
		typescript(),
		production && terser(),
		!production && run({ execArgv: ['--harmony-top-level-await'] }),
	],
}

terser version: 4.6.10
rollup-plugin-terser version: 5.3.0

Sorry for my bad english

Save a byte, remove line break at the end of minified files

I'm currently using the Rollup API to generate files that I later minify with terser, so I decided to try rollup-plugin-terser and see if I could do the whole job in one go.

While testing my new setup I couldn't help noticing that the files created with rollup-plugin-terser are invariably one byte longer than the output produced by terser directly, and the reason is a superfluous newline character at the end of the minified files.

I suspect this is not something strictly related to this plugin and actually has to do with the way Rollup writes files with bundle.write, just wanted to post the issue here in case something can be done.

If it helps, my (simplified) code looks something like this.

const { rollup } = require('rollup');
const { terser } = require('rollup-plugin-terser');

async function minify(input, file, format)
{
    const bundle = await rollup({ input });
    await bundle.write({ file, format, plugins: [terser()] });
}

terser 4.4.1 regression carried by this plugin too

There is currently a breaking regression in terser 4.4.1 and I've got bitten via this lovely rollup plugin, 'cause it uses "^4.1.0" so whatever is latest 4 gets installed in a fresh new npm i.

As my code broke due this change, many others could have similar issues, so since the regression is reproducible and described in the ticket, I wonder if you could update as a patch this plugin with a fixed "terser": "4.4.0" version instead, so that things should not break in the wild.

Thank you in advance for considering this 👋

Seeing unexpected token function since upgrading from 3.0.0 to 4.0.1

Hello,

I am seeing the following with node v11.6.0, rollup v1.0.1, rollup-plugin-terser v4.0.1:

[!] (terser plugin) SyntaxError: Unexpected token function
SyntaxError: Unexpected token function

    at Object.transform (/Users/Matt/Sites/SpringBoard/app/node_modules/.registry.npmjs.org/rollup-plugin-terser/4.0.1/node_
modules/rollup-plugin-terser/transform.js:4:24)
    at execMethod (/Users/Matt/Sites/SpringBoard/app/node_modules/.registry.npmjs.org/jest-worker/23.2.0/node_modules/jest-w
orker/build/child.js:90:29)
    at process.on (/Users/Matt/Sites/SpringBoard/app/node_modules/.registry.npmjs.org/jest-worker/23.2.0/node_modules/jest-w
orker/build/child.js:40:7)
    at process.emit (events.js:188:13)
    at emit (internal/child_process.js:828:12)
    at process.internalTickCallback (internal/process/next_tick.js:72:19)

All my packages are up-to-date including rollup (v1.0.1). If I downgrade to rollup terser v3.0.0 the error goes away. I'm not sure what I need to do to fix the issue and would really appreciate some guidance.

Here's my rollup.config.js:

// Rollup plugins
import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
import { terser } from "rollup-plugin-terser";

export default {
    input : './scripts/application/application.js',
    output : {
        file : './scripts/application/application.min.js',
        format : 'iife',
        name : 'PROJECT'
    },
    plugins : [
        babel({
            exclude : [
                './node_modules/**',
                './scripts/parties/**',
                './scripts/polyfills/**'
            ],
            presets: [[
                '@babel/preset-env', {
                    'modules' : false,
                    'shippedProposals' : true
                }
            ]]
        }),
        resolve(),
        terser({
            sourcemap : false,
            output: {
                comments: function(node, comment) {
                    var text = comment.value;
                    var type = comment.type;
                    if (type == "comment2") {
                    // multiline comment
                        return /@preserve|@license|@cc_on/i.test(text);
                    }
                }
            }
        })
    ]
};

Thank you!

[!] (plugin terser) TypeError: Cannot read property 'references' of undefined

devDependencies

{
"devDependencies": {
    "eslint": "^6.6.0",
    "eslint-config-standard": "^14.1.0",
    "eslint-plugin-import": "^2.18.2",
    "eslint-plugin-node": "^10.0.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.1",
    "jest": "^24.9.0",
    "rollup": "^1.27.3",
    "rollup-plugin-commonjs": "^10.1.0",
    "rollup-plugin-node-resolve": "^5.2.0",
    "rollup-plugin-terser": "^5.1.3"
  }
}

rullup.config.js

const resolve = require('rollup-plugin-node-resolve')
const commonjs = require('rollup-plugin-commonjs')
const { terser } = require('rollup-plugin-terser')
const pkg = require('./package.json')

module.exports = {
  input: 'src/index.js',
  output: [
    {
      file: pkg.main,
      format: 'cjs'
    }
  ],
  plugins: [
    resolve(),
    commonjs(),
    terser()
  ]
}
$ npm run build

> [email protected] build G:\work\func
> rollup -c --environment NODE_ENV:production


src/index.js → dest/index.js...
    Cannot read property 'references' of undefined

[!] (plugin terser) TypeError: Cannot read property 'references' of undefined
TypeError: Cannot read property 'references' of undefined
    at vn.O [as before] (G:\work\func\node_modules\terser\dist\bundle.min.js:1:136818)
    at AST_Expansion.transform (G:\work\func\node_modules\terser\dist\bundle.min.js:1:78900)
    at G:\work\func\node_modules\terser\dist\bundle.min.js:1:79062
    at l (G:\work\func\node_modules\terser\dist\bundle.min.js:1:834)

Substitute userOptions.sourcemap with OutputOptions.sourcemap

Providing that rollup-plugin-terser implements only the renderChunk() hook, that hook accepts as third parameter an OutputOptions object, that OutputOptions object contains a sourcemap property, why doesn't terser() just decide based on the OutputOptions.sourcemap property whether to do or not to do sourcemap?

In other words I am asking to remove useroptions.sourcemaps proprety from the code and documentation.

Tests seem to fail on linux

I was using this plugin in rollup and it worked fine in windows, but crashes in rollup without outputting any files or errors on linux (centos). I ran your package test suite and it seems to fail 7 out of 8 tests even on a clean node docker image:

docker run -it node:8.12 bash -c 'git clone https://github.com/TrySound/rollup-plugin-terser b; cd b; npm install; npm test'

Cloning into 'b'...
remote: Enumerating objects: 128, done.
remote: Total 128 (delta 0), reused 0 (delta 0), pack-reused 128
Receiving objects: 100% (128/128), 67.12 KiB | 0 bytes/s, done.
Resolving deltas: 100% (69/69), done.
Checking connectivity... done.
yarn install v1.9.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...

warning Your current version of Yarn is out of date. The latest version is "1.10.1", while you're on "1.9.4".
info To upgrade, run the following command:
$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
$ yarn test
yarn run v1.9.4
$ jest
  console.warn node_modules/rollup/dist/rollup.js:22152
    Generated an empty bundle

  console.warn node_modules/rollup/dist/rollup.js:22152
    Generated an empty bundle

 FAIL  test/test.js (35.993s)
  ✕ minify (5045ms)
  ✕ minify via terser options (5002ms)
  ✕ minify with sourcemaps (5002ms)
  ✕ allow to disable source maps (5008ms)
  ✓ does not allow to pass sourceMap (13ms)
  ✕ throw error on terser fail (5002ms)
  ✕ works with code splitting (5003ms)
  ✕ allow to pass not string values to worker (5003ms)

  ● minify

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      4 | const { terser } = require("../");
      5 |
    > 6 | test("minify", async () => {
        | ^
      7 |   const bundle = await rollup({
      8 |     input: "test/fixtures/unminified.js",
      9 |     plugins: [terser()]

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:6:1)

  ● minify via terser options

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      16 | });
      17 |
    > 18 | test("minify via terser options", async () => {
         | ^
      19 |   const bundle = await rollup({
      20 |     input: "test/fixtures/empty.js",
      21 |     plugins: [terser({ output: { comments: "all" } })]

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:18:1)

  ● minify with sourcemaps

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      29 | });
      30 |
    > 31 | test("minify with sourcemaps", async () => {
         | ^
      32 |   const bundle = await rollup({
      33 |     input: "test/fixtures/sourcemap.js",
      34 |     plugins: [terser()]

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:31:1)

  ● allow to disable source maps

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      38 | });
      39 |
    > 40 | test("allow to disable source maps", async () => {
         | ^
      41 |   const bundle = await rollup({
      42 |     input: "test/fixtures/sourcemap.js",
      43 |     plugins: [terser({ sourcemap: false })]

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:40:1)

  ● throw error on terser fail

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      58 | });
      59 |
    > 60 | test("throw error on terser fail", async () => {
         | ^
      61 |   try {
      62 |     const bundle = await rollup({
      63 |       input: "test/fixtures/failed.js",

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:60:1)

  ● works with code splitting

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      76 | });
      77 |
    > 78 | test("works with code splitting", async () => {
         | ^
      79 |   const bundle = await rollup({
      80 |     input: ["test/fixtures/chunk-1.js", "test/fixtures/chunk-2.js"],
      81 |     experimentalCodeSplitting: true,

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:78:1)

  ● allow to pass not string values to worker

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      91 | });
      92 |
    > 93 | test("allow to pass not string values to worker", async () => {
         | ^
      94 |   const bundle = await rollup({
      95 |     input: "test/fixtures/unminified.js",
      96 |     plugins: [terser({ mangle: { properties: { regex: /^_/ } } })]

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:93:1)

Test Suites: 1 failed, 1 total
Tests:       7 failed, 1 passed, 8 total
Snapshots:   0 total
Time:        36.447s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

> [email protected] test /b
> jest

  console.warn node_modules/rollup/dist/rollup.js:22152
    Generated an empty bundle

  console.warn node_modules/rollup/dist/rollup.js:22152
    Generated an empty bundle

 FAIL  test/test.js (35.482s)
  ✕ minify (5027ms)
  ✕ minify via terser options (5003ms)
  ✕ minify with sourcemaps (5002ms)
  ✕ allow to disable source maps (5006ms)
  ✓ does not allow to pass sourceMap (2ms)
  ✕ throw error on terser fail (5002ms)
  ✕ works with code splitting (5004ms)
  ✕ allow to pass not string values to worker (5005ms)

  ● minify

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      4 | const { terser } = require("../");
      5 |
    > 6 | test("minify", async () => {
        | ^
      7 |   const bundle = await rollup({
      8 |     input: "test/fixtures/unminified.js",
      9 |     plugins: [terser()]

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:6:1)

  ● minify via terser options

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      16 | });
      17 |
    > 18 | test("minify via terser options", async () => {
         | ^
      19 |   const bundle = await rollup({
      20 |     input: "test/fixtures/empty.js",
      21 |     plugins: [terser({ output: { comments: "all" } })]

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:18:1)

  ● minify with sourcemaps

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      29 | });
      30 |
    > 31 | test("minify with sourcemaps", async () => {
         | ^
      32 |   const bundle = await rollup({
      33 |     input: "test/fixtures/sourcemap.js",
      34 |     plugins: [terser()]

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:31:1)

  ● allow to disable source maps

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      38 | });
      39 |
    > 40 | test("allow to disable source maps", async () => {
         | ^
      41 |   const bundle = await rollup({
      42 |     input: "test/fixtures/sourcemap.js",
      43 |     plugins: [terser({ sourcemap: false })]

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:40:1)

  ● throw error on terser fail

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      58 | });
      59 |
    > 60 | test("throw error on terser fail", async () => {
         | ^
      61 |   try {
      62 |     const bundle = await rollup({
      63 |       input: "test/fixtures/failed.js",

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:60:1)

  ● works with code splitting

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      76 | });
      77 |
    > 78 | test("works with code splitting", async () => {
         | ^
      79 |   const bundle = await rollup({
      80 |     input: ["test/fixtures/chunk-1.js", "test/fixtures/chunk-2.js"],
      81 |     experimentalCodeSplitting: true,

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:78:1)

  ● allow to pass not string values to worker

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

      91 | });
      92 |
    > 93 | test("allow to pass not string values to worker", async () => {
         | ^
      94 |   const bundle = await rollup({
      95 |     input: "test/fixtures/unminified.js",
      96 |     plugins: [terser({ mangle: { properties: { regex: /^_/ } } })]

      at Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:85:20)
      at Object.test (test/test.js:93:1)

Test Suites: 1 failed, 1 total
Tests:       7 failed, 1 passed, 8 total
Snapshots:   0 total
Time:        35.934s, estimated 36s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

Sourcemap not be created by default or with option set to true

New to rollup and terser. npm installed fresh today. Here is my config:

import postcss from 'rollup-plugin-postcss';
import resolve from 'rollup-plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import { terser } from 'rollup-plugin-terser';

module.exports = {
  input: './src/index.js',
  output: [{
    file: './dist/bundle.js',
    format: 'umd'
  }],
  plugins: [
    postcss({
      extract: true,
      sourceMap: true
    }),
    resolve(),
    babel({
      exclude: 'node_modules/**'
    }),
    terser({
      sourcemap: true
    })
  ]
};

Bundled and minified js file is created but no sourcemap. Same when nothing passed to terser(). Looked through code but not seeing yet what's missing(or even where terser is being used by jest-worker??). Advice appreciated thanks!

The terser function should be a default export

Hi!
I think it is strange behaviour that this plugin exports the plugin function as a named export as most rollup plugins (e.g. the official ones from the rollup github account) use a default export.
It just looks strange when importing modules that different plugins have to be imported in different ways.

import json from 'rollup-plugin-json'
import commonjs from 'rollup-plugin-commonjs'
import resolve from 'rollup-plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'

Error: argname.definition is not a function

Hi,

I'm trying to get terser to work on typescript-generated es2015 javascript.

terser() plugin is used without any params as the last plugin. The following error is thrown:

Error: Error transforming chunk with 'terser' plugin: argname.definition is not a function
    at error (/home/user/app/node_modules/rollup/dist/rollup.js:3356:15)
    at /home/user/app/node_modules/rollup/dist/rollup.js:13582:17
    at <anonymous>

rollup: 0.62.0
rollup-plugin-terser: 1.0.1

Happy to provide more details (can't share the repo) - is there a debug mode that could provide more details?

Can't figure out how to use mangle.reserved

Hi,

I am trying out terser plugin, but I need one variable name not to be changed.

First I thought rollup-plugin-typescript2 might be the issue (maybe incorrectly transpile ts file), but I removed it from process (I prepared JS files manually).

In entry JS file I have following code:

let svg = new LogonSvg(c);
svg.InitSvg();

Then my rollup.config.js looks like this:

// import typescript from "rollup-plugin-typescript2"
import commonjs from "rollup-plugin-commonjs";
import resolve from "rollup-plugin-node-resolve";
import { terser } from "rollup-plugin-terser";
import pkg from "./package.json"

export default {
    input: "./wwwroot/js/svgts.js",
    output: [
        {
            file: pkg.module,
            format: "esm",
        },
    ],
    external: [
        ...Object.keys(pkg.dependencies || {}),
        ...Object.keys(pkg.peerDependencies || {}),
    ], plugins: [
        resolve({
            // resolve: require("rollup-plugin-node-resolve"),
            // the fields to scan in a package.json to determine the entry point
            // if this list contains "browser", overrides specified in "pkg.browser"
            // will be used
            mainFields: ["module", "main"], // Default: ["module", "main"]
        }),

        commonjs({
            include: "node_modules/**"
        }),
        
        // typescript({
        //     typescript: require("typescript"),
        //     tsconfig: "./tsconfig.json"
        // }),

        (process.env.NODE_ENV === "production" && terser({
            mangle: { reserved: ['svg'] }
        }))
    ],
}

As you can see, I would like svg variable to remain unchanged, but after terser is finished, there is no svg variable anywhere, instead class is initialised like this:

new class {
    constructor(t) {
           ......
        )
    }
    InitSvg() { ...

and then at the end:

(f).InitSvg();

If I do not use terser plugin, rollup leaves the svg variable and code is like in typescript.

Any idea how to keep original svg declaration?
Thanks,
Mario

`comments` handler is not working (and tests do not properly check)

Hi,

Thanks for this very necessary plugin. Having some problems now though with the comments handler.

comments appears to have no effect; comments get added regardless of whether I return false or true.

And no matter whether I return false or true or throw within comments in your test file, your tests for the comments handler always pass. Note too that the targeted fixture, test/fixtures/unminified.js, has no comments, so the test for this is not going to catch any problems.

Output differs from terser CLI

Was trying to add rollup-plugin-terser to a Stencil project and I noticed this plugin seems to differ from terser CLI’s output. I was able to recreate it here using only Rollup + this plugin

Original file

import { a as patchEsm, b as bootstrapLazy } from './core-6bb3a07e.js';

const defineCustomElements = (win, options) => {
  return patchEsm().then(() => {
    bootstrapLazy([["my-component",[[1,"my-component",{"first":[1],"middle":[1],"last":[1]}]]]], options);
  });
};

export { defineCustomElements };

terser CLI

This is what npx terser -m dist/esm/loader.mjs -o dist/esm/loader.mjs does to that file:

import{a as patchEsm,b as bootstrapLazy}from"./core-6bb3a07e.js";const defineCustomElements=(t,e)=>{return patchEsm().then(()=>{bootstrapLazy([["my-component",[[1,"my-component",{first:[1],middle:[1],last:[1]}]]]],e)})};export{defineCustomElements};

rollup-plugin-terser

This is what rollup-plugin-terser does to that file (with terser({ mangle: true })):

import{a as o,b as a}from"./core-6bb3a07e.js";const e=(e,r)=>o().then(()=>{a([],r)});export{e as defineCustomElements};

Notice that almost everything within .then() is gone.

I have a recreation here using this sample file, and no Rollup config other than this plugin: https://github.com/dangodev/terser-test

Is this correct? Is this a misconfiguration on my part?

(plugin terser) SyntaxError: Unterminated string constant

The problem suddenly appeared, copied from another project and packaged

rollup-plugin-terser
rollup-plugin-filesize
 (plugin terser) SyntaxError: Unterminated string constant
(plugin filesize) TypeError: Cannot read property 'length' of undefined

TIM截图20191107093650
TIM截图20191107103001

Terser generates incorrect sourcemaps.

Hello, i've got simple config:

import pkg from "./package.json";
import typescript from "@wessberg/rollup-plugin-ts";
import { terser } from "rollup-plugin-terser";

const external = [
    ...Object.keys(pkg.dependencies || {}),
    ...Object.keys(pkg.devDependencies || {}),
];

export default {
    input: "src/index.ts",
    output: [{
        file: pkg.main,
        sourcemap: true,
        format: "cjs",
    }],
    external,
    plugins: [
        typescript({
            transpiler: "babel",
        }),
        terser(),
    ],
};

Which produces incorrect sourcemaps (everything points for first line of source code) when i use terser plugin, if i disable it, sourcemaps works correct. Do you have any ideas why that happens?

Package.json dependencies:

    "@babel/plugin-proposal-class-properties": "^7.8.3",
    "@babel/plugin-proposal-decorators": "7.8.3",
    "@babel/plugin-proposal-export-default-from": "7.8.3",
    "@babel/plugin-proposal-object-rest-spread": "7.9.0",
    "@babel/plugin-transform-async-to-generator": "^7.8.3",
    "@babel/plugin-transform-regenerator": "^7.8.7",
    "@babel/preset-env": "^7.8.4",
    "@babel/preset-typescript": "^7.8.3",
    "@wessberg/rollup-plugin-ts": "1.2.21",
    "jsdoc": "3.6.3",
    "npm-run-all": "^4.1.5",
    "rimraf": "^2.7.1",
    "rollup": "^2.0.3",
    "rollup-plugin-size-snapshot": "0.11.0",
    "rollup-plugin-terser": "^5.2.0",
    "rollup-plugin-visualizer": "4.0.1",
    "tslib": "^1.10.0",
    "typescript": "^3.7.5"

babel.config.js:

module.exports = {
    presets: [
        "@babel/preset-env",
        "@babel/preset-typescript"
    ],
    plugins: [
        "@babel/plugin-transform-async-to-generator",
        "@babel/plugin-transform-regenerator",
        ['@babel/plugin-proposal-decorators', { 'legacy': true }],
        ['@babel/plugin-proposal-class-properties', { 'loose': true }],
        ['@babel/plugin-proposal-export-default-from'],
        ['@babel/plugin-proposal-object-rest-spread', { 'loose': true, 'useBuiltIns': true }],
    ],
};

Add ts types please to avoid warning

Hello, my vscode reported to me that it cannot find types. I know, this is just a warning, but it will be cool if it doesn't exist soon :)

Could not find a declaration file for module 'rollup-plugin-terser'. '/home/dmitry/worker/node_modules/rollup-plugin-terser/index.js' implicitly has an 'any' type.
  Try `npm install @types/rollup-plugin-terser` if it exists or add a new declaration (.d.ts) file containing `declare module 'rollup-plugin-terser';`

Feature request: Augment chunk hash

Rollup now has an augmentChunkHash hook for plugins, read more →

The idea is, rollup-plugin-terser could augment the hashes when it's being used, or even when it's own settings change and affect the output of those chunks.

This would prevent scenarios like the one I had tonight, where my chunks' hashes were not changing even though I was experimenting with Rollup's config, enabling and disabling rollup-plugin-terser and some of it's settings, and thus also affecting the output content.

This behavior combined with those chunks being served with some pretty long lasting caching headers and... it took me a while to figure out why things weren't working as expected.

Error when using `mangle.properties.regex` option

When passing the mangle.properties.regex option the following error is thrown:

> Building...
    regex.test is not a function

> regex.test is not a function
error Command failed with exit code 1.

Example options:

...
terser({
  mangle: {
    properties: {
      regex: /^_.+$/,
    },
  },
});
...

Since a regex literal is being used I assume there's a problem serialising it's when it's being passed into the worker (new v2.0.0 feature). I haven't used the jest-worker package before so I'm not sure how it passes data exactly. I could imagine a way around this is to convert the regex into a string, send it, and then back into a regex in the worker but I'm not sure that's viable with jest-worker.

Plugin not working correctly on Jenkins

Hi TrySound, nice work by the way.

Terser version: 4.0.1
Rollup: 1.0.1

I opened an issue on Rollup this morning about bundling not working on Jenkins but on local (mac and ubuntu 18 working good)
Here it is: rollup/rollup#2632

After a 100% rewrite of my rollup.config.js i've detected removing terser from my output.plugins made it working.

Actual behavior: looks like a process.exit is run or something like this, it exists repently

@TrySound If you want the rollup.config i can share it with you if you need.

Breaks with multiple outputs

rollup.config.js

import { terser } from 'rollup-plugin-terser'

export default {
	input: "index.js",
	output: [
		{
			format: "umd",
			file: "index.umd.min.js",
			name: "index",
		},
		{
			format: "es",
			file: "index.module.min.js",
		},
	],
	plugins: [
		terser(),
	],
}

index.js

export const FOO = 2

versions

{
    "rollup": "^0.66.0",
    "rollup-plugin-terser": "^3.0.0",
    "terser": "^3.8.2"
}
PS C:\Users\aval\tsdev\rpterser> npm run rollup

> [email protected] rollup C:\Users\aval\tsdev\rpterser
> rollup -c
Output
index.js → index.umd.min.js, index.module.min.js...
[!] (terser plugin) Error: Farm is ended, no more calls can be done to it
Error: Farm is ended, no more calls can be done to it
    at exports.default.end (C:\Users\aval\tsdev\rpterser\node_modules\jest-worker\build\index.js:166:13)
    at Object.generateBundle (C:\Users\aval\tsdev\rpterser\node_modules\rollup-plugin-terser\index.js:38:19)
    at C:\Users\aval\tsdev\rpterser\node_modules\rollup\dist\rollup.js:20850:25
    at process._tickCallback (internal/process/next_tick.js:68:7)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] rollup: `rollup -c`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] rollup script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\aval\AppData\Roaming\npm-cache\_logs\2018-09-16T16_09_11_939Z-debug.log

Expected output: should work

Commenting out either output config prevents errors.

(feat) option to generate the minified output in a different file

I think a common use case is to generate both full and minified builds. Currently, this require two rollup configs which, except for the terser plugin, are most of the time similar. I'm wondering if it would make sense to introduce a new option to avoid building 2 times?

For example:

module.exports = [
    {
        input: input,
        plugins: [
            resolve(),
            commonjs(),
        ],
        output: {
            file: 'foobar.js',
        }
    },
    {
        input: input,
        plugins: [
            resolve(),
            commonjs(),
            terser()
        ],
        output: {
            file: 'foobar.min.js',
        }
    }
]

would be:

[
    {
        input: input,
        plugins: [
            resolve(),
            commonjs(),
            terser({
                output: {
                    // if not provided, fallback to the same name
                    // as the current entry, and thus replaces it.
                    file: 'foobar.min.js'
                }
            })
        ],
        output: {
            file: 'foobar.js',
        }
    }
]

(I'm not suggesting what the API should look like, that's just an example)

Allow configurable sourcemaps.

Terser command line api allows a customized sourcemap, as follows

    --source-map [options]  Enable source map/specify source map options:
                            `base`  Path to compute relative paths from input files.
                            `content`  Input source map, useful if you're compressing
                                        JS that was generated from some other original
                                        code. Specify "inline" if the source map is
                                        included within the sources.
                            `filename`  Name and/or location of the output source.
                            `includeSources`  Pass this flag if you want to include
                                                the content of source files in the
                                                source map as sourcesContent property.
                            `root`  Path to the original source to be included in
                                    the source map.
                            `url`  If specified, path to the source map to append in
                                    `//# sourceMappingURL`.

but this plugin just enables it with a boolean flag.

It would be nice to pass these configurations as an object, just like:

import { terser } from 'rollup-plugin-terser'

export default {
  input: ['src/**/*.js'],
  output: {
    format: 'esm',
    dir: 'dist/js'
  },
  plugins: [
    terser({
        sourcemap: {
            base: '',
            content: '',
            filename: '',
            includeSources: true,
            root: '',
            url: ''
        }
    })
  ]
}

Update serialize-javascript to 2.1.1 or later to pass npm-auditor-ci

Npm auditor finds this issue:

npm-auditor-ci found 1 advisories.
name                  action                version  severity  title                 url                              
--------------------  --------------------  -------  --------  --------------------  ---------------------------------
serialize-javascript  rollup-plugin-terser  1.9.1    moderate  Cross-Site Scripting  https://npmjs.com/advisories/1426

Info from https://npmjs.com/advisories/1426:

Overview

Versions of serialize-javascript prior to 2.1.1 are vulnerable to Cross-Site Scripting (XSS). The package fails to sanitize serialized regular expressions. This vulnerability does not affect Node.js applications.

Remediation

Upgrade to version 2.1.1 or later.

Using with "require"

I'm trying to use this with rollup plugin for gulp. However, gulp imports everything like this:

const terser = require('rollup-plugin-terser')

This throws and error saying that gulp can't find anything in the plugin. I'm supposing the code is not compatible with commonjs require statements.

Using an es6 import won't work. Any suggestions?

Typescript typings allow big-m sourceMap option but plugin throws an error

The typings included with the plugin define a lowercase-m sourcemap property, but also inherit from terser's MinifyOptions. These include a capital-m sourceMap option. When I use the latter, I get

Error: sourceMap option is removed, use sourcemap instead
at Object.terser (...\rollup-plugin-terser\index.js:8:11)

It looks like the plugin is trying to stop me from passing through the minify option directly to terser, because I guess it does its own handling of sourcemaps. If that's the case, the plugin's typings should probably use something like extends Omit<MinifyOptions, "sourceMap">.

Same constants name in multiple files: error in browser: Uncaught SyntaxError: Identifier 'o' has already been declared

I have a problem.

EXPLANATION

In a website I navigate on page /one, the code in the one.js file executes fine.

After a while I insert in the page (pjax, ajax: no matter how) the second code in two.js file.

The browser complains with this error:

Uncaught SyntaxError: Identifier 'o' has already been declared
- at two.js:1

REPRODUCTION and SOURCE CODE

  1. rollup.config.js:

    import resolve from 'rollup-plugin-node-resolve'
    import commonjs from 'rollup-plugin-commonjs'
    import { terser } from 'rollup-plugin-terser'
    import multiInput from 'rollup-plugin-multi-input'
    
    export default {
      input: ['src/**/*.js'],
      output: {
        format: 'esm',
        dir: 'dist/js'
      },
      plugins: [
        multiInput({ relative: 'src' }),
        resolve({ browser: true }),
        commonjs(),
        terser()
      ]
    }
  2. src/one.js:

    const names1 = ['john1', 'carl1', 'bob1']
    names1.forEach(name1 => {
      console.log('name1:', name1, ', in names1:', ...names1)
    })
  3. src/two.js:

    const names2 = ['john2', 'carl2', 'bob2']
    names2.forEach(name2 => {
      console.log('name2:', name2, ', in names2:', ...names2)
    })
  4. dist/js/one.js:

    const o=["john1","carl1","bob1"];o.forEach(n=>{console.log("name1:",n,", in names1:",...o)});
  5. dist/js/two.js:

    const o=["john2","carl2","bob2"];o.forEach(n=>{console.log("name2:",n,", in names2:",...o)});

QUESTIONS

How to fix this problem?

Can we "prefix" constants name based on file name?

If of course I put everything in just one.js file it works but it's not possible because of the structure of the project.

Can this be used with the Rollup API

Can you give guidance on how to write both the un-minified and minified bundles without processing twice using rollup.rollup and rollup.write? The Rollup documentation doesn't cover this well, and the default export as written up in this documentation doesn't work with rollup.write.

Security Alert: XSS Vulnerability due to serialize-javascript version 1.9.1

Problem:
The latest version of this package uses [email protected], which has a security vulnerability as described below:

Vulnerable versions: < 2.1.1
Patched version: 2.1.1
regular expressions Cross-Site Scripting (XSS) vulnerability
Impact
Affected versions of this package are vulnerable to Cross-site Scripting (XSS). It does not properly mitigate against unsafe characters in serialized regular expressions.

This vulnerability is not affected on Node.js environment since Node.js's implementation of RegExp.prototype.toString() backslash-escapes all forward slashes in regular expressions.

If serialized data of regular expression objects are used in an environment other than Node.js, it is affected by this vulnerability.

Patches
This was patched in v2.1.1.

Screenshot from GitHub's security alert:

Screenshot 2019-12-06 at 11 16 48

Solution:
Update package to ^2.1.1
See PR #53

Plugin fails in Node 6 environments

Error

The following error occurs: SyntaxError: Unexpected token ...

Description

Since the changes introduced here: c096965#diff-168726dbe96b3ce427e7fedce31bb0bcR12 I cannot run rollup-plugin-terser on environments using Node 6. The move from Object.assign to the spread operator for objects breaks it.

My suggestions would be to support Node 6 by using Object.assign again. I could also provide a PR if wished 🙂

Option to disable workers?

For some reason, jest-worker doesn't seem to work in any of my linux machines right now. I haven't been able to dive deeper to figure out why, but maybe it'd be pertinent to add an option to disable them here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.