Forge app and Custom UI app as packages in a Lerna Monorepo

We have a project configured as a monorepo with Lerna. We have many packages in this monorepo, two of them correspond to a Forge app and a Custom UI app. There are other packages, many of them share the same dependencies (testing, typescript, babel, etc), and some others are symlinked as internal dependencies that are consumed by other packages, one of them being the custom ui app.
With this configuration Forge deploy works fine, but Forge tunnel fails finding the bundles for the Custom ui app:

We have also tried keeping the Forge app and the Custom UI app within the same package, but the typescript and babel configurations we use for the Custom UI were messing up the Forge app, so we split them in two packages for this reason.

Using forge deploy is slowing down our team, we’d love to be able to use forge tunnel instead.

I have set up a public repo with the basic configuration where we can see this issue: https://bitbucket.org/naiara_comalatech/forge-with-custom-ui-in-lerna-monorepo/src/main/

to reproduce the issue follow these steps:

yarn install --ignore-engines
npx lerna bootstrap
cd packages/customui
yarn build
cd ../forge
forge deploy
forge install (choose a confluence instance where to install the app)
forge tunnel

Is there any workaround that could potentially work with this setup?

Thanks in advance.

1 Like

I just wanted to give a quick update. I figured out if I specified the output build folder for the customui package within the forge package folder, Forge tunnel’s Docker container would be able to locate those… That part seems to work, but now I get an even more verbose error, which seems to be forge not being able to locate the dependencies in the node_modules folder at project’s root…

I have pushed some changes to the repo to update react-create-app and the build config, and I have created some yarn tasks to ease the install, build & deploy processes, so now instead of all the steps detailed in my previous posts, these are te only ones that are needed to be executed at project’s root folder:

yarn bootstrap
yarn forge-install
yarn tunnel

Any help would be very appreciated

Hi @naiara

Thanks for reporting this. Great to see forge apps being bootstrapped into mono-repos! :+1:

From what I can see, the bundling step is failing when using forge tunnel and this can be explained by the fact that Lerna symlinks the dependencies. However, when we mount the dependencies into our Docker tunnel, those symlinks do not resolve to anything and therefore, the bundling step fails…

If this is the reason, we do not have a solution on this for the time being, and we will need to tackle a fix on our side.

I could try to reproduce by checking out your codebase, but I don’t seem to have access to the link you provided above.

1 Like

Thanks Xavier for your reply,
It seems I created the repo as private by mistake, I just made it public now, let me know if you still have issues accessing the link.