# Modify dev builds to fit inside enterprisey function as a service runtime

**URL:** https://clojureverse.org/t/modify-dev-builds-to-fit-inside-enterprisey-function-as-a-service-runtime/8368
**Category:** shadow-cljs
**Created:** [November 17, 2021, 1:07pm UTC](https://clojureverse.org/t/modify-dev-builds-to-fit-inside-enterprisey-function-as-a-service-runtime/8368 "2021-11-17T13:07:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![orolle](https://clojureverse.org/letter_avatar_proxy/v4/letter/o/919ad9/32.png) [@orolle](https://clojureverse.org/u/orolle)
#### Post date: [November 17, 2021, 1:07pm UTC](https://clojureverse.org/t/modify-dev-builds-to-fit-inside-enterprisey-function-as-a-service-runtime/8368/1 "2021-11-17T13:07:09Z")

</div>

In good clojure tradition, I sneaked in some clojure code into my customers enterprise environment.

I use shadow-cljs to generate a :node-library from my cljs code. This library is deployed to an enterprisey function as a service runtime (similar to AWS lambda) by an enterprisey cli tool. I cannot use shadows dev builds, as the enterprisey cli tool only accepts js files inside a single directory to be deployed to the runtime. Shadow references files outside this directory (like node\_modules) and thus fails.

My workflow right now is to change code and then click manually on release build in shadow-cljs. I wait a bit and then see the changed code deployed inside the faas runtime.

I see 2 possible solutions:

1. Get shadow to put all dev build js files under a single directory.
2. Get shadow to do single file release-like builds on code changes during development.

---

<div class="post-metadata">

### Author: ![thheller](https://clojureverse.org/user_avatar/clojureverse.org/thheller/32/534_2.png) [@thheller](https://clojureverse.org/u/thheller)
#### Post date: [November 17, 2021, 4:41pm UTC](https://clojureverse.org/t/modify-dev-builds-to-fit-inside-enterprisey-function-as-a-service-runtime/8368/2 "2021-11-17T16:41:52Z")

</div>

You can configure `:node-library` with an additional `:output-dir`.

```auto
{:target :node-library
 ...
 :output-to "foo/lib.js"
 :output-dir "foo/files"}

```

This way the `foo` directory will contain all files. The build will however still access files from `node_modules` if you use any npm packages. In that case I’d recommend creating a `package.json` in the `foo` directory and installing the packages you need at runtime there. Don’t know if your “customers enterprise environment” supports this but I’d expect so?

Option 2. is not an option but you can always trigger a manual `release` build if needed. If you run `shadow-cljs server` separately you don’t pay the startup price and `release` builds can be reasonably fast. However optimizations may still take some time which is also why an “automatic” release build on watch changes is impractical.

---

<div class="post-metadata">

### Author: ![orolle](https://clojureverse.org/letter_avatar_proxy/v4/letter/o/919ad9/32.png) [@orolle](https://clojureverse.org/u/orolle)
#### Post date: [November 18, 2021, 6:12pm UTC](https://clojureverse.org/t/modify-dev-builds-to-fit-inside-enterprisey-function-as-a-service-runtime/8368/3 "2021-11-18T18:12:27Z")

</div>

Thanks for the ideas.

I tried option 1. Now the faas deployment tool cannot statically determine the required / require() js files and the deployment to the cloud fails.

Option 2 is super fine ok. Compilation time takes less than 2 seconds. Just clicking on the release button all the time is annoying.

---

<div class="post-metadata">

### Author: ![thheller](https://clojureverse.org/user_avatar/clojureverse.org/thheller/32/534_2.png) [@thheller](https://clojureverse.org/u/thheller)
#### Post date: [November 19, 2021, 6:08am UTC](https://clojureverse.org/t/modify-dev-builds-to-fit-inside-enterprisey-function-as-a-service-runtime/8368/4 "2021-11-19T06:08:12Z")

</div>

> [@orolle](#):
>
> I tried option 1. Now the faas deployment tool cannot statically determine the required / require() js files and the deployment to the cloud fails.

If it really must be a single directory you can just use `:output-dir "foo"`? I was assuming it would also copy sub directories.

Your environment seems rather picky so `release` likely is the best option. Without more info about the environment I can’t make any other suggestions.

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [May 20, 2022, 6:08pm UTC](https://clojureverse.org/t/modify-dev-builds-to-fit-inside-enterprisey-function-as-a-service-runtime/8368/5 "2022-05-20T18:08:20Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
