How to use the terser/dist/bundle.min.js.minify function in terser

To help you get started, we’ve selected a few terser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ionic-team / stencil / src / sys / node / node-sys-worker.ts View on Github external
minifyJs(input: string, opts?: any) {
    if (opts && opts.mangle && opts.mangle.properties && opts.mangle.properties.regex) {
      opts.mangle.properties.regex = new RegExp(opts.mangle.properties.regex);
    }
    const result: d.MinifyJsResult = Terser.minify(input, opts);
    const diagnostics: d.Diagnostic[] = [];

    loadMinifyJsDiagnostics(input, result, diagnostics);

    return {
      output: (result.code as string),
      sourceMap: result.sourceMap,
      diagnostics: diagnostics
    };
  }

terser

JavaScript parser, mangler/compressor and beautifier toolkit for ES6+

BSD-2-Clause
Latest version published 18 days ago

Package Health Score

92 / 100
Full package analysis