serverless / serverless-azure-functions

Serverless Azure Functions Plugin – Add Azure Functions support to the Serverless Framework
MIT License
266 stars 162 forks source link

fix: use webpack output files on offline command #472

Closed LironEr closed 4 years ago

LironEr commented 4 years ago

What did you implement:

Use webpack output files (if exists) on offline command

Closes https://github.com/serverless/serverless-azure-functions/issues/392 https://github.com/serverless/serverless-azure-functions/issues/366

How did you implement it:

serverless-webpack have a trigger on before:offline:start, So I changed offline hook so we will have offline:start hook. Also, change the generated function.json scriptFile property to point to .webpack folder Everything should work the same as before, just when running offline command webpack plugin (if exists) will compile the files

How can we verify it:

cd examples/typescript-webpack
npm install
npm run offline

You should see the error: image This is the current behavior.

To fix it we need to link the new version of the library. go to the root directory and run npm link then go back to the example folder and run npm link serverless-azure-functions

npm run offline

image

AFTER releasing a new version with this fix we should update the version in the example folder so it will work without the need to run npm link

Todos:

Note: Run npm run test:ci to run all validation checks on proposed changes

Is this ready for review?: YES
Is it a breaking change?: NO