I have a Create-React-App 5 project using Yarn 3 and TypeScript 4. The web app uses a library in the same repo through Yarn's portal:
protocol (Yarn workspaces are not used).
myRepo
├── myLib
│ ├── package.json
│ ├── yarn.lock
│ └── src
│ ├── index.js
│ └── macro.js
├── myApp
│ ├── package.json
│ ├── yarn.lock
│ └── src
│ ├── App.tsx
│ ├── App.test.tsx
│ └── index.tsx
└── yarnrc.yml
myApp/package.json
uses a portal like so:
"dependencies": {
"myLib": "portal:../myLib",
My top-level Yarn config:
# yarnrc.yml
nodeLinker: node-modules
If I substitute file:
for portal:
, everything works fine. Even with portal:
, yarn build
and yarn start
within myApp
still work fine, but yarn test
becomes a problem: /Users/luke/myRepo/myLib/src/index.js: The macro imported from "./macro" must be wrapped in "createMacro" which you can get from "babel-plugin-macros".
Huh? I'm certainly not trying to do anything with Babel macros. Moreover, that stuff is in a library and not the app itself.
What's going on, and how do I fix it?