Code Monkey home page Code Monkey logo

Comments (10)

srod avatar srod commented on May 24, 2024

You can remove all console.log with drop_console option, like that :

new compressor.minify({
    type: 'uglifyjs',
    fileIn: 'filein.js',
    fileOut: 'fileout.js',
    options: ['--compress drop_console=true'],
    callback: function(err, min) {
    }
});

from node-minify.

hellomaya avatar hellomaya commented on May 24, 2024

Worked! 👍 Thanks a lot.

from node-minify.

PierBover avatar PierBover commented on May 24, 2024

The solution proposed by @srod doesn't work anymore.

compressor.minify({
    compressor: 'uglifyjs',
    options: ['--compress drop_console=true'],
    input: files,
    output: './build.js',
    callback: function(err, min){
        console.log("JS Build Done!");
    }
});

I'm using the beta "node-minify": "^2.0.0-beta.0"

from node-minify.

srod avatar srod commented on May 24, 2024

Can you try to pass the options object like that ?

compressor.minify({
  compressor: 'uglifyjs',
  input: 'foo.js',
  output: 'bar.js',
  options: {
    compress: true,
    drop_console: true
  },
  callback: function (err, min) {}
});

from node-minify.

PierBover avatar PierBover commented on May 24, 2024

I still get console.log() messages

from node-minify.

srod avatar srod commented on May 24, 2024

Ok, I will have a look.

from node-minify.

PierBover avatar PierBover commented on May 24, 2024

Hey @srod did you figure it out?

from node-minify.

srod avatar srod commented on May 24, 2024

It seems that we have to pass a "compress" object, according uglifyjs documentation :

compressor.minify({
  compressor: 'uglifyjs',
  input: 'foo.js',
  output: 'bar.js',
  options: {
    compress: {
      drop_console: true
    }
  },
  callback: function (err, min) {}
});

from node-minify.

PierBover avatar PierBover commented on May 24, 2024

Sorry for taking so long to test this.

Now I'm using:

compressor.minify({
    compressor: 'uglifyjs',
    input: files,
    output: './build/widgets.js',
    options: {
        compress: {
            drop_console: true
        }
    },
    callback: function(err, min){
        if(err) console.log(err);
        console.log("JS Build Done!");
    }
});

files is an array with files.

I'm getting this error:

JS_Parse_Error {
  message: 'Unexpected token punc «,», expected punc «:»',
  filename: 0,
  line: 1784,
  col: 6,
  pos: 45269,
  stack: 'Error\n    at new JS_Parse_Error (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:1526:18)\n    at js_error (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:1534:11)\n    at croak (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2026:9)\n    at token_error (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2034:9)\n    at expect_token (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2047:9)\n    at expect (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2050:36)\n    at eval (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2610:13)\n    at eval (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2073:24)\n    at expr_atom (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2540:35)\n    at maybe_unary (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2716:19)\n    at expr_ops (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2751:24)\n    at maybe_conditional (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2756:20)\n    at maybe_assign (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2780:20)\n    at expression (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2799:20)\n    at expr_list (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2565:24)\n    at subscripts (eval at <anonymous> (XXXXXX/node_modules/uglify-js/tools/node.js:22:1), <anonymous>:2699:30)' }

(I've obfuscated the path on my drive)

from node-minify.

PierBover avatar PierBover commented on May 24, 2024

It was a problem on my end.

from node-minify.

Related Issues (20)

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.