software-mansion/react-native-gesture-handler

ReferenceError: __DEV__ is not defined

gozegotushar opened this issue · 5 comments

Description

DEV is not defined
ReferenceError: DEV is not defined
at ./node_modules/react-native-gesture-handler/lib/module/handlers/createHandler.js

Steps to reproduce

Screenshot 2024-02-20 at 10 51 05 PM

Snack or a link to a repository

https://github.com/gozegotushar/poc_react_native_web

Gesture Handler version

2.15.0

React Native version

using react native web

Platforms

Web

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

Hi! It looks like problem with your setup. Gesture handler is a library for React Native, not for React. I see that you've added react-native-web, however I don't think it will suffice - __DEV__ is defined in react-native, not in react-native-web. Have you tried setting up your app with react-native init instead of create-react-app?

Same issue

Hi @tuanlam92! Do you use react-native in your project?

Hi @m-bert . I have react-native-web project. I found the solution where we can add the plugin using webpack configuration. Thank you for asking.
config.plugins.push( new webpack.DefinePlugin({ __DEV__: isDevelopment, }), );

Hi @tuanlam92! Thanks for this information, it seems to work! 😄

Also, as far as I can see the reproduction repository already uses it. I'm closing this issue, but feel free to reopen it if you still have this problem.