sindresorhus / ow

Function argument validation for humans
https://sindresorhus.com/ow/
MIT License
3.8k stars 105 forks source link

Build errors when using ow in React app compiled with vite #246

Closed omerlh closed 1 year ago

omerlh commented 1 year ago

I have a react app and I want to use ow. I am using Vite, but the same issue happens with create-react-app. This is the error:

[commonjs--resolver] Failed to resolve entry for package "ow". The package may have incorrect main/module/exports specified in its package.json: No known conditions for "." entry in "ow" package
error during build:
Error: Failed to resolve entry for package "ow". The package may have incorrect main/module/exports specified in its package.json: No known conditions for "." entry in "ow" package

I have a minimal reproduction code here - just run yarn & yarn build.

From reading about the issue, it seems this is related to how the module is defined - see this comment for a similar issue with vite.