Parts of code not executed anymore after minification
See original GitHub issueI’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:
- Checkout https://github.com/MichaelKohler/sandbox-minify-error-babili-webpack-plugin
- npm install
- ./node_modules/backpack-core/bin/backpack build
- node dist/error.js
- 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:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@MichaelKohler Just curios, why do you want to minify your server code?
will check, thanks!