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

Stopped working in react-native-web #731

Closed
gituser8796 opened this issue Sep 1, 2024 · 15 comments
Closed

Stopped working in react-native-web #731

gituser8796 opened this issue Sep 1, 2024 · 15 comments
Labels
help wanted Extra attention is needed

Comments

@gituser8796
Copy link

Uncaught ReferenceError: exports is not defined

It was working perfectly before 3.x.x

Copy link

Guten Tag, Hans here! 🍻

It looks like you are experiencing an issue after updating to version 3.x.x, but we need more information to help you better. Please provide relevant logs from your runtime environment.

For example, if you are using Xcode for iOS, you can find the logs in the Xcode logs window. For Android, please use adb logcat to gather logs during the error occurrence.

Once you have that information, we'll be able to assist you more effectively.

If you want to support the project and get quicker attention on issues, consider becoming a sponsor on GitHub. It helps a lot!

Note: If you think I made a mistake, please ping @mrousavy to take a look.

@gituser8796
Copy link
Author

It's standard react-native-web

@amutsch
Copy link

amutsch commented Sep 2, 2024

@gituser8796 I haven't booted my project in a couple weeks but this was working in web the when I last used it, what version of the library are you using and what version of react native?

For Reference I checked my project, RN 0.74.2
rn-mmkv - 3.0.0-beta-6

@gituser8796
Copy link
Author

@amutsch - I'm using react-native@0.75.1 and react-native-mmkv@3.02

In order to get web working I have to manually set react-native-mmkv@2.12.2 (which prevents mobile form loading)

Thank you!

@amutsch
Copy link

amutsch commented Sep 3, 2024

@gituser8796 That means you are not using react native new architecture. 3.x.x only works with new architecture enabled in react native. This is working as designed according to the documentation that @mrousavy has with the release.

@amutsch
Copy link

amutsch commented Sep 6, 2024

I upgraded my project tonight to 75.2 and mmkv 3.0.2, my android build was working on my windows machine, I will build and test my web, ios and android from my mac when I get back on Sunday

@arasrezaei
Copy link
Contributor

i got "Identifier 'module' has already been declared", a line before function getMMKVTurboModule() {

@amutsch
Copy link

amutsch commented Sep 10, 2024

I have everything working just fine.
Versions:
RN75.2,
mmkv - 3.0.2
react-native-web: 0.19.12

Webpack is spitting out some warnings due to how turbomodules need to be defined but it is not preventing starting or using the web side.
Android I had to clear the build folders and then everything built fine
IOS I had to clear the podfile.lock and gemfile.lock and everything is working fine there now as well.

Following best practice for a major upgrade of my main libs I cleared my node_modules and yarn.lock file as well. Everything is working as I expect it to.

Hope this helps but not seeing any issues in my setup. Kicking off my CICD on my update here shortly, I've gone from 74.x and version 2.12.0 to new arch with 3.0.6-beta to 75.2

@gituser8796
Copy link
Author

hi @amutsch any progress on this one? it's becoming an issue for use to use this repo - so any fix would be appreciated!

@mrousavy mrousavy added the help wanted Extra attention is needed label Sep 13, 2024
@amutsch
Copy link

amutsch commented Sep 13, 2024

@gituser8796 I'm going to need more details as all you are providing is a reference Error. I outlined what versions I used at 74 and 75 and before and after new arch and everything is working for me. As I mentioned react-native-web is now required to use 3.x lib(it wasn't with 2.x) but other than some startup warnings everything is working fine on my side,

What relevant lib versions are you using(RN, RNWeb, Webpack/vite/other) Compiling this to working web opens up a whole new suite of items to check. Can your create a small reproduction scenario independent of your app? Is your app available to public on github, if so I can take a look there too.

@ISnowFoxI
Copy link

ISnowFoxI commented Sep 14, 2024

Are you guys using expo or react-native cli?

I am trying to look into this issue, created a a new expo project and it seems like it is working, if you could provide a reproduction repo, I'd be happy to look into it more

@mrousavy
Copy link
Owner

Thanks for all your help guys 🙏🖤

@amutsch
Copy link

amutsch commented Oct 16, 2024

@mrousavy no feedback for over a month, I think we can close this, both myself and ISnowFoxl have verified working with expo and RN-cli with RN-web

@mrousavy
Copy link
Owner

awesome thank you!

@dppo
Copy link

dppo commented Oct 17, 2024

This error should be exported by the ESM method used on the react-native-web side, such as the vite used. TurboModuleRegistry does not exist on the react-native-web side, so in
import {TurboModuleRegistry} from 'react-native';
An error will be reported when

alias: {
      'react-native': 'react-native-web',
      'react-native-mmkv': 'react-native-mmkv/lib/commonjs',
    },

This method can be used temporarily, but I think a better method may be needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants