Important info:
- yarn 2 (berry)
- Next.js
I have a following script to run Next.js app (either next dev or next start), and to initialise Datadog APM tracing:
"dev": "NODE_OPTIONS='-r ./utils/tracer.js' next dev"
Since I need to use a dependency in tracer.js
, I'm also using .pnp.cjs
initialisation so node is able to understand .yarn
folder:
require('../.pnp.cjs').setup();
const tracer = require('dd-trace')
...
the command seems to execute successfully, but as soon as I actually enter the web app, I get this:
there seems to be a problem with resolving imports, it already narrows down to @tanstack-react-query-virtual-e64c51...
Help greatly appreciated, I didn't think integrating with yarn 2 would be such a pain long-term
What works is when I use nodeLinker: node-modules, but I want to stay with .yarn linking since it's the default, main mode right now.