This is a duplicate Question, please see discussion on Github:
Goal: Import custom modules into Az Fx (i.e. import myModule.js into myFunction)
Observations:
-
in Azure Console, node_modules are stored in your services Service Account / Files / / site / wwwroot
-
If you include a custom node module, myModule.js, at the root level and run serverless deploy it will be packaged in .serverless/.zip. However, it will not appear in wwwroot, which is where it needs to be for importing into myFunction
Challenge: Make sure our custom node modules, myModule.js, make it into wwwroot so we can import them.
Potential Solutions:
-
After serverless deploy, use azure-cli to upload custom modules - going with this for now
-
After serverless deploy, manually upload via azure console
-
Use include in serverless.yml - Issue on github
you can add packaging information here
#package:
include:- myMoudle.js
- src/modules/myModule.js
Questions:
- Is there a certain place I should be placing my custom node modules so serverless gets them into wwwroot?