Monorepo setup fs/promises #118
Answered
by
florianbepunkt
florianbepunkt
asked this question in
Q&A
-
Using this lib in a larger NPM monorepo setup, gives me the following error: It seems that fs/promises is not polyfilled. Any ideas how to resolve this / make it work?
|
Beta Was this translation helpful? Give feedback.
Answered by
florianbepunkt
Dec 29, 2023
Replies: 1 comment 4 replies
-
This probably doesn't have much to do with the fact you're in a monorepo. If I had to guess, |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No, I'm not using NextJS. I investigated the issue... basically there are two things going wrong:
1. Incomplete polyfill
The issue would happen with any non-browser compatible module. You currently prevent this for most people in your lib by polyfilling node internals with a Vite plugin. But the polyfill you are using, does not support
fs/promises
, onlyfs
(I guess the same is true for the other node:std/promises packages).It would be the easiest solution if all Node internals would be polyfilled. It kind of defeats one of the main monorepo purposes if I have to undo code-colocation...
2. Tree-shaking
The tree-shaking is off for the preview (building works fine). Not sure why that is. Mo…