json-schema-ref-parser icon indicating copy to clipboard operation
json-schema-ref-parser copied to clipboard

Browser is trying to require `fs/promises`

Open dav-is opened this issue 1 year ago • 2 comments

The browser is trying to require fs/promises in Next.js, failing to compile when using 10.1.0. Rolling back to 10.0.1 seems to fix it.

In 10.0.1, this library uses fs: https://github.com/APIDevTools/json-schema-ref-parser/blob/12cb26a764b975de38143458d06972772609be76/lib/resolvers/file.js#L1

In 10.1.0, this library uses fs/promises: https://github.com/APIDevTools/json-schema-ref-parser/blob/a5b3946fbb62683ab69e3747a8893014591726af/lib/resolvers/file.ts#L1

In package.json, fs is marked in browser as false: https://github.com/APIDevTools/json-schema-ref-parser/blob/a5b3946fbb62683ab69e3747a8893014591726af/package.json#L46-L48

I think fs/promises should be included in there instead.

dav-is avatar Jun 14 '23 19:06 dav-is

I am getting the same error. Is there a workaround?

ballcoach12 avatar Aug 03 '23 18:08 ballcoach12

I am getting the same error. Is there a workaround?

I had to downgrade to 10.0.1 and I don't use the fs resolver

dav-is avatar Aug 05 '23 20:08 dav-is

This is fixed in v11+

jonluca avatar Mar 05 '24 23:03 jonluca