software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
5.85k stars 954 forks source link

ReferenceError: __DEV__ is not defined #2769

Closed gozegotushar closed 1 month ago

gozegotushar commented 2 months ago

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

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

m-bert commented 2 months ago

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?

tuanlam92 commented 2 months ago

Same issue

m-bert commented 2 months ago

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

tuanlam92 commented 2 months ago

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, }), );

m-bert commented 1 month ago

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.