Questions tagged [serverless-webpack-plugin]
23 questions
18
votes
2 answers
Cannot find module 'source-map-support/register
I've followed the webpack4 example to setup the config: https://github.com/serverless-heaven/serverless-webpack/tree/master/examples/babel-webpack-4
as I got the error "cannot find module source-map-support/register".
I've looked into the already…

Shiva MSK
- 484
- 1
- 6
- 16
13
votes
5 answers
Cannot find module 'puppeteer'
In a AWS Lambda/NodeJS runtime, I'm attempting to import from an absolute path (/opt/nodejs/node_modules/puppeteer).
Source runs fine locally but, once bundled with Webpack/serverless-webpack and run in AWS Lambda, require('puppeteer') results in:…

logicalicy
- 857
- 1
- 9
- 19
5
votes
0 answers
How to package knex migrations to a module?
I have a Serverless framework project with serverless-webpack. Webpack bundles the application itself nicely.
I have setup the lambdas to try migrations after update like described in the linked blog post:…

rice
- 159
- 1
- 2
- 11
4
votes
0 answers
Execute Typescript code inside Serverless config
I use Serverless framework to deploy my backend.
My lambdas are written in Typescript and I deploy them using serverless-webpack plugin.
Serverless allows to reference variables in javascript files using syntax:
# serverless.yml
service:…

Niv-Mizzet
- 361
- 3
- 6
2
votes
0 answers
How to resolve the error message "Unzipped size must be smaller than 262144000" after migrating to serverless webpack
I'm getting a size limit error for my lambda after migrating to serverless webpack! I've migrated to webpack to resolve the issue so something's not right if I'm still getting the same error, see below for the error message.
Many thanks!!
Error…

James
- 41
- 1
- 4
2
votes
1 answer
Debugging servlerless offline function with VSCode - source map issue?
I have created a simple mail function for AWS Lambda using serverless. For development, I am using serverless-offline to replicate the functionality of Lambda and using VSCode as my IDE. I am also using serverless-webpack to generate my resultant…

Zakalwe
- 1,444
- 3
- 14
- 25
2
votes
3 answers
serverless-webpack can't resolve module
Getting this error from serverless-webpack:
ERROR in ../db/actions/index.js
Module not found: Error: Can't resolve 'amazon-dax-client' in '/var/task/db/actions'
@ ../db/actions/index.js 2:24-52
@ ../db/db.js
@ ./crop.js
My webpack.config.js file…

genestd
- 384
- 3
- 16
1
vote
1 answer
Can I programmatically generate a list of local pure ESM node_modules for Webpack/babel-loader?
Is there an easy way to get a list of your local node_modules that are pure ESM (i.e. only support ES6 import/export syntax)?
While trying to create a CommonJS bundle for a Serverless Framework project I needed to use npm packages that had recently…

Joost Schuur
- 4,417
- 2
- 24
- 39
1
vote
0 answers
ESM complains on the serverless-webpack/lib/validate.js using require
I have a dependency to serevrless-webpack 5.7.1 and I have "type": "module" in the package.json. When I try to deploy the code using serverless, it complains on the use of require in serverless-webpack/lib/validate.js in which I do not have the…

Thisun Pathirage
- 101
- 9
1
vote
0 answers
Want to use something like an eval() or Function() to evaluate a string inside of a serverless project
I need to evaluate a string that I get in a function parameter. I've done it before using both eval() and Function(). But when I try the same thing with eval() inside of an AWS serverless project, I get a serverless webpack compilation error saying…

Jason Maharjan
- 11
- 2
1
vote
0 answers
How to set keepOutputDirectory to true when using serverless-bundle plugin
serverless-bundle plugin does not seem to have an option to override keepOutputDirectory:true. By default it gets removed on sls deploy command.
How can we keep .webpack folder with .js and jsmap files after deployment as we need it to be able to…

systemdebt
- 4,589
- 10
- 55
- 116
1
vote
3 answers
Serverless Webpack generates empty files in ZIP package
I'm facing with a rather annoying and frustrating anomaly with Serverless + Webpack generating empty files in the .serverless/.zip.
Config
serverless.yml
...
webpack:
webpackConfig: ./webpack.config.js
includeModules:…

haxpanel
- 4,402
- 4
- 43
- 71
1
vote
1 answer
webpack: configuration.entry should be an non-empty object
serverless deploy is throwing this error with latest webpack verstion.
Serverless: Bundling with Webpack...
Webpack Options Validation Error -----------------------
WebpackOptionsValidationError: Invalid configuration object. Webpack has been…

martin
- 862
- 9
- 28
1
vote
2 answers
How to setup serverless.yml and webpack.config for a multiple-runtime AWS Lambda service
I want to deploy AWS Lambda functions with Node8.10 and Ruby2.5 runtimes from one serverless.yml file.
I set up the following folder structure, with /node and /ruby holding my respective handlers.
-/nodeRubyLambdas
-/node
-handler.js
…

mCubed
- 23
- 1
- 7
1
vote
2 answers
Is it possible to bundle/minimize ONLY the node_modules folder with webpack?
I have a relatively small codebase which requires not to be bundled and I need to keep the folder structure in the output. Yet, node_modules folder is quite large and I'd like to keep it bundled?/minimized with dead code elimination.
Example folder…

pars
- 3,700
- 7
- 38
- 57