Better support for Serverless Framework#29
Better support for Serverless Framework#29dbryantm wants to merge 3 commits intofrankthelen:masterfrom
Conversation
…ess Framework when you're bundling functions individually. Otherwise it seems to still be bundling all of lodash even if the project doesn't require it.
|
To make the size more smaller, what about removing the bluebird with es6 native promise? |
|
I wouldn't disagree with that. I also think it wouldn't be a bad idea to move to using Babel so you can use imports and tree shaking. Some of the changes would be breaking enough that the maintainer would need to make those decisions though. |
|
Yes, Bluebird could be removed without breaking anything, I think. I'll check it. Thanks. |
|
Merged the new version of master into the feature branch. |
|
@frankthelen, any chance you could review this? Thanks in advance! |
|
Honestly, requiring lodash's individual method packages is an antipattern. In addition, they are not maintained anymore (deprecated). Rools depends on the main library, but requires individual packages, e.g., |
|
The only way to achieve tree shaking successfully with lodash is to use lodash-es instead and just require the individual functions such as: Also, I'd be glad to make those changes in another pull request if you would be willing to review it. Thanks in advance! |
|
Unfortunately, on the Node side, ES modules are still flagged experimental, even in Node 10. And since Rools is supporting Node >= 8, this does not look like an option to me. Maybe we should eliminate lodash altogether. What Rools is using from it (intersection, isBoolean, isFunction, isInteger, isString) could easily also be achieved differently without lodash. |
|
We could use https://www.npmjs.com/package/is for the validators. |
|
Yeah, that could possibly work though I would like to see the size of the library when it gets bundled with webpack. I could try some tests to see what the end results are. |
Reduces the size even further for projects that are using the Serverless Framework while bundling functions individually for AWS Lambdas. Otherwise it seems to still be bundling all of lodash even if the project doesn't require it.