
Security News
Critical Security Vulnerability in React Server Components
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.
@substantial/serverless-webpack
Advanced tools
Serverless plugin to bundle your javascript with Webpack
A Serverless v1.0 plugin to build your lambda functions with Webpack.
This plugin is for you if you want to use the latest Javascript version with Babel; use custom resource loaders; try your lambda functions locally and much more!
npm install serverless-webpack
Add the plugin to your serverless.yml file:
plugins:
- serverless-webpack
By default the plugin will look for a webpack.config.js in the service directory.
In alternative you can specify a different file or configuration in the serverless.yml with:
custom:
webpack: ./folder/my-webpack.config.js
An base Webpack configuration might look like this:
// webpack.config.js
module.exports = {
entry: './handler.js',
target: 'node',
module: {
loaders: [ ... ]
}
};
Note that, if the output configuration is not set, it will automatically be
generated to write bundles in the .webpack directory. If you set your own output
configuration make sure to add a libraryTarget
for best compatibility with external dependencies:
// webpack.config.js
module.exports = {
// ...
output: {
libraryTarget: 'commonjs',
path: '.webpack',
filename: 'handler.js', // this should match the first part of function handler in serverless.yml
},
// ...
};
By default, the plugin will try to bundle all dependencies. However, you don't
want to include all modules in some cases such as selectively import, excluding
builtin package (ie: aws-sdk) and handling webpack-incompatible modules.
In this case you might add external modules in
Webpack externals configuration.
Those modules can be included in the Serverless bundle with the webpackIncludeModules
option in serverless.yml:
// webpack.config.js
var nodeExternals = require('webpack-node-externals')
modules.export = {
// we use webpack-node-externals to excludes all node deps.
// You can manually set the externals too.
externals: [nodeExternals()],
}
# serverless.yml
custom:
webpackIncludeModules: true # enable auto-packing of external modules
All modules stated in externals will be excluded from bundled files. If an excluded module
is stated as dependencies in package.json, it will be packed into the Serverless
artifact under the node_modules directory.
By default, the plugin will use the package.json file in working directory, If you want to
use a different package conf, set packagePath to your custom package.json. eg:
# serverless.yml
custom:
webpackIncludeModules:
packagePath: '../package.json' # relative path to custom package.json file.
Note that only relative path is supported at the moment.
You can find an example setups in the examples folder.
The normal Serverless deploy procedure will automatically bundle with Webpack:
serverless create -t aws-nodeserverless deployTo start a local server that will act like the API Gateway use the following command. Your code will be reloaded upon change so that every request to your local server will serve the latest code.
serverless webpack serve
Options are:
--port or -p (optional) The local server port. Defaults to 8000The serve command will automatically look for the local serverless.yml and serve
all the http events. For example this configuration will generate a GET enpoint:
functions:
hello:
handler: handler.hello
events:
- http:
method: get
path: hello
To run your bundled functions locally you can:
serverless webpack invoke --function <function-name>
Options are:
--function or -f (required) is the name of the function to run--path or -p (optional) is a JSON file path used as the function input eventOr to run a function every time the source files change use watch:
serverless webpack watch --function <function-name> --path event.json
Options are:
--function or -f (required) is the name of the function to run--path or -p (optional) is a JSON file path used as the function input eventTo just bundle and see the output result use:
serverless webpack --out dist
Options are:
--out or -o (optional) The output directory. Defaults to .webpack.In the examples folder there is a Serverless project using this
plugin with Babel. To try it, from inside the example folder:
npm install to install dependenciesserverless webpack run -f hello to run the example functionFAQs
Serverless plugin to bundle your javascript with Webpack
The npm package @substantial/serverless-webpack receives a total of 0 weekly downloads. As such, @substantial/serverless-webpack popularity was classified as not popular.
We found that @substantial/serverless-webpack 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
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.

Research
/Security News
We spotted a wave of auto-generated “elf-*” npm packages published every two minutes from new accounts, with simple malware variants and early takedowns underway.

Security News
TypeScript 6.0 will be the last JavaScript-based major release, as the project shifts to the TypeScript 7 native toolchain with major build speedups.