0.1.3 • Published 5 years ago

azure-functions-bundle v0.1.3

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Azure Functions Bundle

Write Azure Functions using ES Modules, and bundle them using Rollup to a dist folder to ensure smaller functions and fixed dependencies getting shipped to Azure.

Install

npm install --save-dev azure-functions-bundle

Usage

npx afbundle

Options

Specify the location of the bundler config file to be used. Must be a JSON file

-c | -config <file location>

Config File

By default the CLI will look for azurebundle.config.json in the root of the folder.

{
    "dist": "<dist folder>",
    "entries": [
        {
            "name": "<function App Name>",
            "folder": "<Root folder of Function App source>"
        }
    ],
    "rollupConfig": "OPTIONAL: <RollupJS Input options>"
}

dist Required - Distribution folder that the Function Apps will be bundled too

entries Required - Array consisting of an object with the following properties.

  • name Required - The name of the Function App that will be shipped

  • folder Required - The root source folder of the Function App that must be bundled

rollupConfig Optional - Override the default config that Rollup uses to bundle the Function Apps. Correlates to the RollupJS input options as defined here https://rollupjs.org/guide/en/#rolluprollup

The following Rollup and Babel plugins are bundled with the project, and be configured through the rollupConfig property.

  • rollup-plugin-node-resolve
  • rollup-plugin-commonjs
  • rollup-plugin-json
  • rollup-plugin-babel
  • rollup-plugin-node-builtins
  • @babel/preset-env
  • @babel/plugin-syntax-import-meta

zip Optional - boolean By default zip files of each Function App will be created in the dist folder. If set to false, the zip files will not be created.

Basic Example

{
    "dist": "./dist",
    "entries": [
        {
            "name": "prodFunction",
            "folder": "./src/myFunctionApp"
        }
    ]
}