mmazzarolo / react-native-universal-monorepo

React Native boilerplate supporting multiple platforms: Android, iOS, macOS, Windows, web, browser extensions, Electron.
MIT License
1.7k stars 150 forks source link

Web-based `build` commands fail because of `AsyncStorage` #2

Open ramyareye opened 2 years ago

ramyareye commented 2 years ago

Hello, thanks for you great work :)

I got this error on build web

~: yarn web:build
yarn run v1.22.10
$ yarn workspace @rnup/web build
$ craco build
Creating an optimized production build...
Failed to compile.

./node_modules/@react-native-async-storage/async-storage/lib/module/AsyncStorage.js
Attempted import error: 'merge-options' does not contain a default export (imported as 'mergeOptions').

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /usr/local/Cellar/node/16.4.2/bin/node
Arguments: /usr/local/Cellar/yarn/1.22.10/libexec/lib/cli.js build
Directory: /Users/***/react-native-universal-monorepo/packages/web
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
~:
mmazzarolo commented 2 years ago

Hey @ramyareye , thanks for reporting!
I'm able to reproduce the issue as well... looks weird, because it's happening only in the production bundle 🤔 I'm wondering if it's related to this recent release: https://github.com/react-native-async-storage/async-storage/pull/657

mmazzarolo commented 2 years ago

Yeah, older versions of async-storage seem to work fine.
I'm a bit busy writing a blog post about this repo, but once I'm done I can investigate further 👍 (Unless someone else wanna tackle it first)

bart-vandervliet commented 2 years ago

Any update on this? I'm currently experiencing this in a production build on yarn 1.22.18.

yarn run v1.22.18
$ node scripts/build.js
Creating an optimized production build...
Failed to compile.

./node_modules/@react-native-async-storage/async-storage/lib/module/AsyncStorage.js
Attempted import error: 'merge-options' does not contain a default export (imported as 'mergeOptions').

error Command failed with exit code 1.
anodynos commented 1 year ago

Has anyone found a workaround on this?