Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__DEV__ support #1580

Closed
littlehome-eugene opened this issue Apr 9, 2020 · 4 comments
Closed

__DEV__ support #1580

littlehome-eugene opened this issue Apr 9, 2020 · 4 comments

Comments

@littlehome-eugene
Copy link

The problem
If you want to share code between RN and RN-web, __DEV__ should also be provided in the both platform.

However I can't add DEV using const __DEV__ = process.env.NODE_ENV !== 'production'; new webpack.DefinePlugin({__DEV__})

I can set window.__DEV__ fine, but RN code uses __DEV__

I've also tried adding module:metro-react-native-babel-preset

Expected behavior

Environment (include versions). Did this work in previous versions?

  • React Native for Web (version): 0.12.2
  • React (version): 16.12.0
  • Browser: chrome
@necolas
Copy link
Owner

necolas commented Apr 9, 2020

That's something a bundler like webpack has to do for you

@necolas necolas closed this as completed Apr 9, 2020
@KingAmo
Copy link
Contributor

KingAmo commented Jun 10, 2020

could anyone anyone help me with how we could get __DEV__ in react-native-web with webpack ?
i really do not familiar with webpack

@KingAmo
Copy link
Contributor

KingAmo commented Jun 10, 2020

@LuoTuxiu
Copy link

LuoTuxiu commented Aug 8, 2021

  plugins: [
    new webpack.ProvidePlugin({
      __DEV__: process.env.NODE_ENV === 'production' || true,
    }),
  ],

when I add DEV to webpack plugins, it goes other error:

ERROR in specifier.charCodeAt is not a function

ERROR in specifier.charCodeAt is not a function

ERROR in specifier.charCodeAt is not a function

anybody could help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants