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.

Parts of code not executed anymore after minification

See original GitHub issue

I’m using babili through the babili-webpack-plugin on an express-based project. It seems that certain parts of the code won’t be run without error once I’m using that plugin.

Steps to reproduce:

  1. Checkout https://github.com/MichaelKohler/sandbox-minify-error-babili-webpack-plugin
  2. npm install
  3. ./node_modules/backpack-core/bin/backpack build
  4. node dist/error.js
  5. head to localhost:3000 and observe the terminal output

Output:

Example app listening on port 3000!
Error: hiiii im wrong!
    at /Users/mkohler/projects/error-test/dist/error.js:1:636
    at Layer.handle [as handle_request] (/Users/mkohler/projects/error-test/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/mkohler/projects/error-test/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/Users/mkohler/projects/error-test/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/mkohler/projects/error-test/node_modules/express/lib/router/layer.js:95:5)
    at /Users/mkohler/projects/error-test/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/Users/mkohler/projects/error-test/node_modules/express/lib/router/index.js:335:12)
    at next (/Users/mkohler/projects/error-test/node_modules/express/lib/router/index.js:275:10)
    at expressInit (/Users/mkohler/projects/error-test/node_modules/express/lib/middleware/init.js:40:5)
    at Layer.handle [as handle_request] (/Users/mkohler/projects/error-test/node_modules/express/lib/router/layer.js:95:5)

However, due to the Error being thrown, I would expect the error handler to kick in and log my console.log here: https://github.com/MichaelKohler/sandbox-minify-error-babili-webpack-plugin/blob/master/index.js#L10 . This does not happen.

When I now remove the plugin definition in https://github.com/MichaelKohler/sandbox-minify-error-babili-webpack-plugin/blob/master/backpack.config.js#L13 and run the build and node commands from above again, I get the following output:

Example app listening on port 3000!
let me log myself.. I should be fine, right? Error: hiiii im wrong!
    at /Users/mkohler/projects/error-test/dist/error.js:78:8
    at Layer.handle [as handle_request] (/Users/mkohler/projects/error-test/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/mkohler/projects/error-test/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/Users/mkohler/projects/error-test/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/mkohler/projects/error-test/node_modules/express/lib/router/layer.js:95:5)
    at /Users/mkohler/projects/error-test/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/Users/mkohler/projects/error-test/node_modules/express/lib/router/index.js:335:12)
    at next (/Users/mkohler/projects/error-test/node_modules/express/lib/router/index.js:275:10)
    at expressInit (/Users/mkohler/projects/error-test/node_modules/express/lib/middleware/init.js:40:5)
    at Layer.handle [as handle_request] (/Users/mkohler/projects/error-test/node_modules/express/lib/router/layer.js:95:5)

This is exactly how I would expect it to work as I now see the console.log.

Could somebody have a look at this and tell me if I’m doing something wrong or if that really is a bug in babili?

Feel free to ask any questions you might have, I’m happy to answer them 😃

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
vigneshshanmugamcommented, Apr 18, 2017

@MichaelKohler Just curios, why do you want to minify your server code?

0reactions
neophobcommented, May 9, 2017

will check, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Minified Javascript doesn't work when combined in one file
In my case it was because I specified dependencies in requirejs 's shim , for a library ( perfect-scrollbar ) that already supports...
Read more >
BundlerMinifier does not work after update Visual Studio #536
My colleague has the older Visual Studio Enterprise 2019 Version 16.8.3 installed and BundleMinifier is still working there. My output window in Visual...
Read more >
The complete best practices for minifying CSS - LogRocket Blog
Minifying CSS files is more nuanced than you might think at first. Learn the various minification tools, how to determine and remove unused ......
Read more >
Better JavaScript Minification - A List Apart
When the with statement executes, the reference to message is mapped to the object property and so the displayed message is, “Hello, world,...
Read more >
4 Reasons Why Your Source Maps are Broken - Sentry Blog
In a sense, source maps are the decoder ring to your secret (minified) code. However, they can be tricky to get working properly....
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