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.

Allow serverless-webpack configuration options to pass through

See original GitHub issue

Currently, I need to set keepOutputDirectory: true for serverless-webpack, but I can’t. There should be a way to pass valid options through to serverless-webpack instead of shaming people for needing more than the defaults.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

david-l-rileycommented, Feb 24, 2020

That impression comes from the copy in

This plugin does not support customizing the Babel and Webpack configs, since serverless-webpack does a pretty good job with that.

But the problem is that if you want to do something outside of what’s explicitly exposed, you have to go and edit the source to add it to the webpack config (I suppose it could also be done with scripts, but that seems kinda gross).

I don’t think adding an option to overlay custom options would be really invalidating the purpose of the plugin. I think it does a great job setting default options! But there needs to be a way to inject/overlay custom options to the webpack config (not just custom options to serverless-webpack), or things like aliasing modules to quiet webpack warnings can’t be done. I suspect just loading an overlay file and doing an Object.assign() would do the trick, though I haven’t tested that; perhaps a PR would be the way to go here?

Apologies if that came across as combative, that’s not my intent; I think you’ve done a great job of really simplifying the process of building a usable Webpack serverless module (especially when it comes to including static assets, which is why I tried it out in the first place). Thank you for your hard and probably often thankless work on this very useful plugin.

jayaircommented, Feb 23, 2020

While we are definitely trending in the direction of adding most of the Webpack options, I’m not sure what’s giving the impression that we are refusing to expose all the options?

That said keepOutputDirectory is something we should add. I’m happy to accept PRs for this.

While we are on the subject, what other serverless-webpack options do we have left? Aside from the webpackConfig option; since altering that invalidates the purpose of this plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Serverless Webpack - Serverless Framework: Plugins
serverless -webpack exposes a lib object, that can be used in your webpack.config.js to make the configuration easier and to build fully dynamic...
Read more >
Serverless Webpack in Lambda Simplified 101 - Learn | Hevo
This blog explains the different aspects of Serverless Webpack in Lambda. ... This config option allows you to exclude files from function ...
Read more >
Adding Serverless Webpack to your Project - YouTube
When you deploy a serverless project, by default it uploads all of the code into every lambda. This can mean you quickly end...
Read more >
Resolving Serverless Webpack Issues | by Dustin Goodman
A story about how I debugged an issue with our webpack bundles on a serverless infrastructure and the key takeaways about developing ...
Read more >
Optimise your Lambda functions using Webpack
Today we'll cover why and how to package your Node.js Lambda functions for deployment using Webpack and the Serverless Framework.
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 Post

No results found

github_iconTop Related Hashnode Post

No results found