-
Notifications
You must be signed in to change notification settings - Fork 29
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
Change to .mjs breaks usage in Expo web (React Native) #6
Comments
Interesting. This does sound like an expo/metro bug - maybe you could try the approach outlined here? https://github.com/apollographql/apollo-client/blob/main/CHANGELOG.md#notices ...but instead of |
This issue can also be seen when trying to run portable text in storybook (v6) actually. |
You can fix it in storybook by adding it this to the main.ts config:
|
Got it working similar to @fernandofleury, introduced a const createExpoWebpackConfigAsync = require('@expo/webpack-config');
module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);
config.module.rules.push(
{
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
});
return config;
}; Tried the apollo-client approach (tweaking the metro config), but no change. It does look to be more related to the webpack config Expo uses for web, rather than an issue with Metro (as it works in native contexts without modification). Looks like maybe something Expo web should be handling out of the box, Thanks for the pointers 👍 |
Just updated
@portabletext/react
to v1.0.4, unfortunately the package no longer functions out of the box under Expo web.Looks to be related to the change to using .mjs. Can confirm it works when downgrading back to v1.0.3.
Might be related to this: facebook/metro#535, however the package seems to work fine under other (native) Expo targets (Android/iOS).
Minimum repo here: https://github.com/4lun/expo-portabletext-react (run
yarn web
)Error from expo-cli:
Error in browser console:
Not clear to me if this is mostly an issue with Expo, and/or if there's potentially some sort of webpack config change I can make to resolve it. Any pointers greatly appreciated.
The text was updated successfully, but these errors were encountered: