Using Netlify Dev CLI with unbundled functions and a static site

I may be conflating a few different features/docs, but I’d like to use something like this directory structure to dev locally and have Netlify deploy on github hooks:

|- functions/
    |- foo/
        |- node_modules/
        |- index.js
        |- package.json
    |- bar/
        |- node_modules/
        |- index.js
        |- package.json
|- publish/
    |- index.html

Essentially, I’d like to call both foo and bar functions from index.html while I work locally on my machine on all three. Bonus: Netlify would build and deploy as I have it now working from master branch and Github pull requests.

Maybe I’m asking for too much magic here :smile: but is this possible?
Thanks!

@tbeseda, if you configure a functions directory, this should “just work”:

This is done with the magic (okay, not really) zip-it-and-ship-it functionality in our build image.

Quoting that repo’s README below (the CLI section):

A minimal CLI version of zip-it-and-ship-it is provided for use inside the build-image, although this is automatically invoked on users behalf during builds and you typically do not need to run this yourself.

Have you configured a functions directory in netlify.toml or the UI?

1 Like

Ended up being super simple. Just needed to make sure the .js file in my function subdirectory had the same file name as its parent folder: functions/foo/foo.js, functions/bar/bar.js, etc.

It mentions this in the docs but I overlooked it.

1 Like