Build admin with monorepo

Hi,
I have a nextjs monorepo project that have an strapi/admin as an app inside, it worked fine in dev but got error when trying to build.

> yarn run admin:build  
> nx run admin:build:production  

⠋ Building build context
✔ Building build context (245ms)
⠋ Building admin panel

ERROR in ./node_modules/@strapi/admin/dist/_chunks/AuthenticatedApp-GC9sytrp.mjs 795:26-35
export 'Lightning' (imported as 'Lightning') was not found in '@strapi/icons' (possible exports: Alien,..., Write)

I was check my node that using latest version of @strapi (v4.25.8), @strapi/icons (v1.19.0) and it already has export Lightning

I was trying to search the error but nothing useful, any idea to help resolve are appreciated.

This topic has been created from a Discord post (1276024141853495357) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

Since its a monorepo, do you have your dependencies split into multiple package.json files?

yes, it contains my scripts settings, I also checked dependencies and the libs are all at v4.25.8

But do you have everything in 1 single package.json file or do you have multiple package.json files?

Strapi is not able to compose dependencies from different package.json failes

It expects a single package.json file in the root directory of the Strapi project

I have all the libraries declared in both package.json files (although I think only the package.json in the root directory works since only the root directory has ./node_module)

Nope, thats not gonna work

Those are workspaces, they basically abstract dependencies on different levels to avoid repetition and share higher lvl dependencies and such

When they reconstruct they obvs add them in the root lvl node_modules, but its reading into the nested package.json as well

Strapi does not support workspaces at the moment and Im unsure if it will

So what can I do at this point?

Not use workspaces, xD

You can use a monorepo with Strapi as long as you dont use workspaces

Basically whatever subdirectory Strapi lives in, will be viewed as the root directory by Strapi

And treat it from there as if Strapi was a normal repository

(1 root lvl package.json, etc)

I will try, thanks you :+1:

Update 1: Remove nx and running strapi admin alone will make it worked (still trying make it working in monorepo)