question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

node-minify gets stuck or outputs "undefined" as content

See original GitHub issue

I’m running --compressor all on a large file, for example: https://raw.githubusercontent.com/hems/efx-api-node/master/dist/efx-a3a245411be.js

but all i get on my console is a stuck screen:

image

node version: v9.1.1

and this is my package.json:

....
  "scripts": {
    "build": "npm run build:web:browserify; npm run build:web:minify; npm run build:web:hash",
    "build:web:browserify": "del ./dist/efx*.js; browserify ./src/efx.js --standalone EFX -o ./dist/efx.js",
    "build:web:minify": "node-minify --compressor all --input './dist/efx.js' --output './dist/efx.min.js'",
    "build:web:hash": "hash-filename ./dist/efx*.js;del ./dist/efx.js",
    "build:web:run": "browserify --debug ./src/efx.js --standalone EFX | browser-run --port 2222"
  },
  "dependencies": {
    "0x.js": "^0.38.4",
    "bluebird": "^3.5.1",
    "ethereumjs-util": "^5.2.0",
    "lodash": "^4.17.10",
    "request": "^2.87.0",
    "request-promise": "^4.2.2"
  },
  "devDependencies": {
    "browser-run": "^5.0.0",
    "browserify": "^16.2.2",
    "chai": "^4.1.2",
    "del-cli": "^1.1.0",
    "ganache-cli": "^6.1.4",
    "hash-filename": "^1.0.4",
    "mocha": "^5.1.1",
    "mochify": "^5.8.0",
    "nock": "^9.4.1",
    "node-minify": "^3.1.0",
    "standard": "^11.0.1",
    "web3": "^1.0.0-beta.34"
  }

Here is the repository with the code that is yielding that issue: https://github.com/hems/efx-api-node

You should be able to reproduce the problem by:

git clone
cd efx-api-node
npm install
npm run build:web:browserify
npm run build:webminify
# by now you can go to ./dist and you will see the .min.js file content is "undefined"

I have tried running something like compressor --uglify but the best i can get is a file with “undefined” written inside.

What am i doing wrong?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
geunhocommented, Jul 17, 2018

Looks like uglify-js has an issue on minify js files written in es6 convention.

I resolved it by : require('uglify-js') -> require('uglify-es') on https://github.com/srod/node-minify/blob/develop/lib/compressors/uglifyjs.js#L13

1reaction
srodcommented, Aug 4, 2018

I’ve released 3.2.0, and added uglify-es. I tested with efx-api-node, it’s ok with it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js displays "undefined" on the console - Stack Overflow
js on my Windows 7 machine. On execution of JavaScript, I get an undefined message along with successful execution of the expression. What's ......
Read more >
Top 10 Most Common Node.js Developer Mistakes - Toptal
exports” and “exports” is very important, and is often a cause of frustration among new Node.js developers. Mistake #6: Throwing Errors from Inside...
Read more >
cannot read properties of undefined (reading 'path') nodejs
You're calling connectDB() which returns immediately (because it's async). You don't 'wait' until dbconnection is being set.
Read more >
uglify-js - npm
UglifyJS is a JavaScript parser, minifier, compressor and beautifier toolkit. Note: uglify-js supports JavaScript and most language features in ...
Read more >
node-mssql | Microsoft SQL Server client for Node.js
As one Node JS process is able to handle multiple requests at once, ... value - Output parameter value initial value. undefined and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found