Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 1.27 KB

README.md

File metadata and controls

30 lines (23 loc) · 1.27 KB

pnpm-serverless-demo

A small demo repo to show basic configuration to make pnpm work with serverless framework

Gettings started

Run:

pnpm i
sls invoke local -f quotes # to test locally
sls deploy # Look at bundled .js inside .serverless folder

Learnings

  • pnpm creates hardlinks to global pnpm store in node_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 eiher serverless-plugin-include-dependencies (includes node_modules) or serverless-esbuild (bundler like webpack but faster)

Problems faced

pnpm does not work with serverless-plugin-typescript by default

  • When using pnpm with serverless, 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 with node-linker=hoisted property. Source

Invalid option in build() call: "incremental"

  • Issue with esbuild plugin. Details here