retyui / react-quick-pinch-zoom

A react component that providing multi-touch gestures for zooming and dragging on any DOM element.
https://react-quick-pinch-zoom.netlify.app/
308 stars 46 forks source link

When I build in a test environment NODE_ENV=test I have problem with require('prop-types') #76

Closed epascal closed 1 year ago

epascal commented 1 year ago

In line 1058 of component.tsx the test for production should be either test against production and test or for development

if (process.env.NODE_ENV !== 'production') { <-------------------------------- should be === 'development' or !== 'test! || !== 'production' const { any, element, object, number, func, bool } = require('prop-types');

// @ts-ignore PinchZoom.propTypes = { children: element, containerProps: object,

if (process.env.NODE_ENV !== 'production') {

epascal commented 1 year ago

PS: really great component, thank you for the work

retyui commented 1 year ago

@epascal Why I have to exclude prop-types from test environment ? what problem do you have with require('prop-types')

psalz commented 1 year ago

I ran into this as well, the problem is that prop-types is not declared as a dependency of the package!

retyui commented 1 year ago

To fix it just install as dev deps. :

yarn add -D prop-types