-
Notifications
You must be signed in to change notification settings - Fork 8
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
Import into react-native is broken #180
Comments
Hi @vanjaoljaca , you are correct. This is a known issue that needs to be addressed and you are correct that it is related to environment detection. It was mentioned previously in this ticket: #175 I will leave this ticket open as it directly addresses the bug in question. |
So, after investigation, the issue is related to commonjs vs esm modules. Chalk 5, which is what Adze uses by default is ESM only. Expo tries to bundle Adze using commonjs, and then explodes when it tries to bundle chalk. There is no solution to resolving this issue directly in Adze. The solution is to add a small overrides declaration in package.json to use Chalk v4 vs the default v5 that comes with Adze. Add this to your package.json. {
"overrides": {
"adze": {
"chalk": "^4.1.2"
}
}
} I will be putting these directions in the documentation under the FAQ's section which should solve this issue for expo users. |
Thanks for investigating. Chalk override fixed most of the issues, though there were still two adze code changes I had to do. I'm not sure how these would be generalized to not require manual node_modules hacking. in global.js:32
in util.js:38 downgrading to chalk v4 requires a small change
for yarn, package.json overrides is written as:
|
@vanjaoljaca , why did you need to comment this code block out?
What issue did that resolve for you? |
without that change I get errors because _glbl.navigator.userAgent is undefined global.js:75
constants.js:173
|
Thank you. That's helpful. Expo is somehow thinking |
ah yes I see envIsWindow maps to isBrowser, which is how I ended up making isBrowser return false
|
Hi... I was experimenting with picocolors instead of Chalk to address some of the issues I found. I also spotted the Here's the link to the PR: #181 |
I have merged @tiagobnobrega 's changes from his PR. @vanjaoljaca , can you confirm that this has resolved your issues? |
Thanks @AJStacy this worked great. Thanks @tiagobnobrega as well |
I'm having trouble getting this to load into a mobile app, I think it is incorrectly detecting the environment and using some incompatible libraries.
I tried to workaround with polyfills but couldn't get it working
The text was updated successfully, but these errors were encountered: