![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
serverless-optimizer-plugin
Advanced tools
Serverless Optimizer Plugin - Significantly reduces Lambda file size and improves performance
Browserifies, minifies your Serverless Node.js Functions on deployment, and more!
Reducing the file size of your AWS Lambda Functions allows AWS to provision them more quickly, speeding up the response time of your Lambdas. Smaller Lambda sizes also helps you develop faster because you can upload them faster. This Severless Plugin is absolutely recommended for every project including Lambdas with Node.js.
Note: Requires Serverless v0.5.0 or higher.
###Setup
npm install serverless-optimizer-plugin --save
plugins
array in your Serverless Project's s-project.json
, like this:plugins: [
"serverless-optimizer-plugin"
]
custom
property of your s-function.json
add an optimize property."custom": {
"optimize": true
}
If you rely on the aws-sdk, be sure to read the Common Pitfalls section.
All done!
Configuration options can be used by setting the optimize
property to an object instead of a boolean value. The following options are available:
true
, this will disable optimizer. This is effectively the same as setting the optimize
property to false
, but it does not require the deletion of any other configuration values within the optimize
object. This is a good option for temporarily disabling while debugging."custom": {
"optimize": {
"disable": true
}
}
string
or [string]
, optimizer will be disabled for the specified stage(s). This is beneficial if you do not want optimizer to run on a specific stage to aid in debugging."custom": {
"optimize": {
"excludeStage": ["dev", "test"]
}
}
string
or [string]
, optimizer will be disabled for the specified region(s)."custom": {
"optimize": {
"excludeRegion": ["us-east-1"]
}
}
Browserify options can be included as normal configuration options to the optimize
object. The following options are supported:
For more information on these options, please visit the Browserify Documentaton.
Uncaught {"errorMessage":"Cannot find module '/usr/lib/node_modules/aws-sdk/apis/metadata.json'"...
To fix this, the aws-sdk should be excluded by using the exclude
Browserify option. Since the aws-sdk is always available to an AWS Lambda, it should never need to be included.
"custom": {
"optimize": {
"exclude": ["aws-sdk"]
}
}
Bundles are packaged with Browserify, and can be transformed to support ES6 features with Babelify.
Install babelify within the root context of your project:
npm install babelify --save
npm install babel-preset-es2015 --save
Add the babelify transform to s-function.json
:
{
"name": "myfunc",
"runtime": "nodejs",
"custom": {
"optimize": {
"exclude": [ "aws-sdk" ],
"transforms": [
{
"name": "babelify",
"opts": {
"presets": [
"es2015"
]
}
}
]
}
}
}
We're currently working on adding support for Typescript. Check back for updates!
FAQs
Serverless Optimizer Plugin - Significantly reduces Lambda file size and improves performance
The npm package serverless-optimizer-plugin receives a total of 0 weekly downloads. As such, serverless-optimizer-plugin popularity was classified as not popular.
We found that serverless-optimizer-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.