I'm encountering a peculiar issue when trying to link a local sub-project package (x) in the frontend project of a monorepo using npm link. The problem manifests differently depending on the order of commands I execute. First, I cloned and ran npm install in both repositories. Second, I run yarn build and npm link in the x project. Then, here's what I'm doing next in the frontend project:
Scenario 1:
- I run
npm link @monorepoName/x. - Then, I run
npm install regenerator-runtime@latest. - Finally, I execute
npm run dev:hot.
After these steps, the link to my local x project gets removed, and my frontend project seems to revert to using the x version from the npm repository.
Scenario 2:
- First, I run
npm install regenerator-runtime@latest. - Then, I execute
npm link @monorepoName/x. - Lastly, I run
npm run dev:hot.
In this scenario, when I open the project URL in the browser, I get an error: 'Uncaught ReferenceError: regeneratorRuntime is not defined'.
I don't know why the order of these commands impacts the behavior in such a way. I'm seeking insights into what might be causing these issues and how to resolve them.
Any suggestions on what might be causing these issues or how to properly link a local package while managing dependencies like regenerator-runtime would be greatly appreciated.
Let me know in the comments if you need more information.