iskconnoida / iskconnoida.org

4 stars 1 forks source link

Move to Yarn PnP #104

Open dhruvkrishnavaid opened 1 month ago

dhruvkrishnavaid commented 1 month ago

The reason of build failiure after #102 was merged was because of yarn not being able to access the pnp loader files (like .pnp.cjs) which were placed in the root directory while our docker container just copied the backend and frontend directories separately. To fix this issue is interestingly simple enough. We just need to change how we set up our working directory for docker. Currently we cd into the backend and frontend folders separately and then run the respective start and build commands. This results in two separate node_modules folders, one each in backend and frontend. This breaks our workspace configuration on the docker image and hence, we cannot guarantee successful builds each time we push. The new strategy would instead copy the root directory altogether, and rm the unused directories (means frontend is unused for running backend, similarly backend is unused for building frontend). This would ensure that the local development and the CI build environment are constant and aligned with each other and also the fact that if "it's running on my machine" it can run on the cloud too. The new strategy would also be helpful in getting rid of the redundant separate .yarn folders in bothfrontend and backend directories. This is due to the fact that copying the whole root directory would copy the root .yarn folder too, which would allow yarn to use that binary. Currently, these extra yarn binaries in both the workspaces are redundant and unused in our local development machines, while they serve a critical purpose for the docker image, which makes the workspace uncertain and we cannot guarantee successful builds every commit. Peace ✌️

dhruvkrishnavaid commented 3 weeks ago

110 has #102 revived

dhruvkrishnavaid commented 3 weeks ago

This change somehow also reduces the base bundle size from ~408KB to ~362KB