'Migrate CRA project to existing Nx workspace

I have the Nx workspace with React and Express apps created via the official React tutorial from Nx docs. Also, I have an independent CRA project that has just one commit after using npx create-react-app command. I want to add my CRA project to Nx workspace preserving git histories. How can I do that?

I had read docs pages about preserving git histories and manual migration and then tried to migrate the project this way:

  1. Migrated CRA project to a new Nx workspace automatically used npx cra-to-nx command as the docs said.
  2. Added remote repository with initial Nx workspace.
  3. Merged the branch that contained the new Nx workspace with the main branch from the initial Nx workspace.
  4. To solve all the conflicts I accepted incoming changes (didn't change the configs of the initial Nx workspace).

The migration was successful but then I tried to serve or build migrated CRA app and got this error: build error

Where did I go wrong? Maybe I deleted some important configuration when was solving the conflicts?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source