A small demo repo to show basic configuration to make pnpm
work with serverless framework
Run:
pnpm i
sls invoke local -f quotes # to test locally
sls deploy # Look at bundled .js inside .serverless folder
pnpm
creates hardlinks to globalpnpm
store innode_modules
- You can find the store's location by running
pnpm store path
serverless-typescript-plugin
converts tscode to js but does not do bundling. Requires eiherserverless-plugin-include-dependencies
(includes node_modules) orserverless-esbuild
(bundler like webpack but faster)
- When using
pnpm
withserverless
, transitive dependencies (e.g.,form-data
that axios needs) is not included in final bundle by default - This is be resolved by either:
- bundling before deploying (e.g., with
serverless-esbuild
pluging) - create
.npmrc
withnode-linker=hoisted
property. Source
- bundling before deploying (e.g., with
- Issue with
esbuild
plugin. Details here