Hi all! Maybe this isn't entirely a ts question? But this feels like the most appropriate place I have access to that may be able to help.
So, I've been converting my project to a monorepo. I also switched from npm to pnpm. I have most everything set up. My packages are building fine. My code is compiling properly. However, in the last step, for some reason I am now unable to run node dist/index.js. It fails at the module resolver trying to resolve any of my workspace packages.
Here's the specific error:
const resolvedOption = FSLegacyMainResolve(packageJsonUrlString, packageConfig.main, baseStringified);
^
Error: Cannot find package '/Users/user/Documents/kobold/apps/client/node_modules/pf2etools-data/package.json' imported from /Users/user/Documents/kobold/apps/client/dist/src/index.js
at legacyMainResolve (node:internal/modules/esm/resolve:213:26)
at packageResolve (node:internal/modules/esm/resolve:831:14)
at moduleResolve (node:internal/modules/esm/resolve:901:20)
at defaultResolve (node:internal/modules/esm/resolve:1131:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:390:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:359:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:234:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
at link (node:internal/modules/esm/module_job:84:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
Node.js v21.6.2```
I can run:
`user@laptop client % ls /Users/user/Documents/kobold/apps/client/node_modules/pf2etools-data/package.json
/Users/user/Documents/kobold/apps/client/node_modules/pf2etools-data/package.json`
So obviously the symlink is there. But node doesn't see it for some reason.
In the app/client/package.json, I have that module specified like this: ``"pf2etools-data": "workspace:*"`. And it's identified by pnpm, installed, and tsc compiles it, vscode uses its types, and typescript compilers can run it. But I just can't get the actual node executable to run it.
Weirdly enough, I can use node with the ts-node loader, and that works. Is there something I'm doing wrong here? Something weird with symlinks? Is there any way I can run that with the regular node loader?