Serverless-offline: Expose serverless-webpack build errors

Created on 27 Jan 2017  路  4Comments  路  Source: dherault/serverless-offline

When serverless-offline is running and I make code changes, the console output always displays Webpack rebuilt, even if the code contains errors and the rebuild failed.

Then, instead of a sensible error about my badly formed code, I get a "Cannot find module" error when invoking the function.

I just wasted close to an hour thinking something was wrong with my Webpack module resolution config... I didn't realize what the real problem was until I ran $ sls webpack which gave me a nicely formatted error about my badly formed code.

Is there a way to expose these error messages when serverless-offline triggers a Webpack rebuild?

enhancement help wanted

Most helpful comment

Incurred in the same problem, if it can helps anyone, installing the friendly-errors-webpack-plugin resolve the issue!

All 4 comments

Hi @adambiggs, thanks for raising this issue.

I don't know much about sls webpack, I think I know were the error is swallowed.
I might take a look. Anyone with intel on the matter please share :)

A quick solution would be to include bail: true in your webpack.config.js file. This will cause serverless-offline to crash with the error. Not sure if there is a more graceful solution.

Thanks @mikestaub that's definitely an improvement.

Incurred in the same problem, if it can helps anyone, installing the friendly-errors-webpack-plugin resolve the issue!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MEGApixel23 picture MEGApixel23  路  4Comments

ozbillwang picture ozbillwang  路  4Comments

stunningpixels picture stunningpixels  路  3Comments

aldofunes picture aldofunes  路  3Comments

JimLynchCodes picture JimLynchCodes  路  4Comments