New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip webpack on a per function basis #255

Open
johnf opened this Issue Oct 19, 2017 · 13 comments

Comments

Projects
None yet
7 participants
@johnf
Copy link

johnf commented Oct 19, 2017

This is a Feature Proposal

Description

I have a use case where in the same project I need to mix javascript and python lambda functions. The use case is I have a custom cloudformation resource written in python which I want to deploy before I use it in the resources section.

I think it would be useful to be able to skip this plugin on a perfunction basis.

For example

functions:
  pthon_func:
    runtime: python2.7
    webpack: false

@johnf johnf referenced a pull request that will close this issue Oct 19, 2017

Open

Support skipping webpack on a per function basis #256

7 of 7 tasks complete

@HyperBrain HyperBrain added the feature label Oct 19, 2017

@HyperBrain

This comment has been minimized.

Copy link
Member

HyperBrain commented Oct 26, 2017

MS recently started with Java support for Azure. So it seems that more and more providers support other languages than JS.

So the least instrusive approach to add the feature would be just to check if function.runtime || provider.runtime results in anything that matches /nodejs/. That will at least catch all AWS cases if we put it into a condition like provider.name === 'aws'.

Imo this should be sufficient for a first approach. As soon as there is any more in common (like the runtime property) for other providers, we can think of supporting them too.

@johnf What do you think? Can you try to change the PR to this minimal approach, and use the condition NOT in the index, but in the compile/deploy steps where the entries array is reverse-mapped to functions again. Additionally you should rebase to the cuirrent master as there is the extensisbility PR already merges that changes the internal lifecycles to be extensible for plugin authors who want to plug into the serverloess-webpack plugin.

@johnf

This comment has been minimized.

Copy link

johnf commented Nov 9, 2017

@HyperBrain Have made some changes to #256

@HyperBrain

This comment has been minimized.

Copy link
Member

HyperBrain commented Nov 9, 2017

@johnf Thanks 👍 . I'll have a look later.

@HyperBrain HyperBrain added this to the 4.1.0 milestone Nov 18, 2017

@HyperBrain

This comment has been minimized.

Copy link
Member

HyperBrain commented Nov 18, 2017

@johnf Sorry. I completely forgot about this.

@HyperBrain HyperBrain removed this from the 4.1.0 milestone Nov 21, 2017

@HyperBrain

This comment has been minimized.

Copy link
Member

HyperBrain commented Nov 21, 2017

I'll do the 4.1.0 release today. This will become part of 4.1.1 as it would block the 4.1.0 right now.

@XBeg9

This comment has been minimized.

Copy link

XBeg9 commented Feb 6, 2018

@HyperBrain any updates here? I am looking forward to get this functionality. Thanks

@HyperBrain

This comment has been minimized.

Copy link
Member

HyperBrain commented Feb 6, 2018

@XBeg9 It seems we need some additional tests and maybe corrections in the pending PR. Accoring to this comment #256 (comment) the provided solution does not seem to be complete.

@XBeg9

This comment has been minimized.

Copy link

XBeg9 commented Feb 6, 2018

@HyperBrain I will try to help.

@laboro18

This comment has been minimized.

Copy link

laboro18 commented Jul 25, 2018

May I ask what is the latest on this issue? I too am looking forward to getting this functionality into the serverless framework

@Stereobit

This comment has been minimized.

Copy link

Stereobit commented Aug 2, 2018

Just found this issue and wanted to share my current use case as it is slightly different. I would love to user webpack only on a subset of functions. I currently porting some legacy functions into the serverless repo where all other functions don't need webpack. I would like to avoid to bundle those as well.

@HyperBrain

This comment has been minimized.

Copy link
Member

HyperBrain commented Aug 2, 2018

Hi @Stereobit . You should use webpack (and sls-webpack), regardless, if your functions need to be transpiled. the reason for that is, that the plugin does packaging much better than serverless, i.e. it only packages dependencies that are really needed.
Whole bundling is not necessary and you should set custom: webpack: includeModules: true. Then all external node modules won't be bundled (as long as you use node-externals.

If you use the standard serverless packaging it will bundle ALL modules you have installed which bloats the packages.

@20112077

This comment has been minimized.

Copy link

20112077 commented Sep 12, 2018

Are there any updates on this? I am also trying to mix nodejs and python functions in one serverless project.

@MohibWasay

This comment has been minimized.

Copy link

MohibWasay commented Dec 10, 2018

Any updates on this? Is there any possibility for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment