-
Notifications
You must be signed in to change notification settings - Fork 224
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
React native package main
field related error.
#404
Comments
any workarounds for this ? |
i found this |
any news on this? |
|
@rhythnic why did you mention Node.js? The question was about React-Native. Your PR does not help to fix |
But this config for metro bundler helped me: // https://github.com/ioveracker/demo-react-native-emotion/blob/master/metro.config.js
const { getDefaultConfig } = require('metro-config');
module.exports = (async () => {
const {
resolver: { sourceExts },
} = await getDefaultConfig();
return {
resolver: {
// Add cjs extension so stylis will load.
sourceExts: [...sourceExts, 'cjs'],
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
})(); |
I am using expo for my react native project and this worked for me const { getDefaultConfig } = require('@expo/metro-config');
const defaultConfig = getDefaultConfig(__dirname);
module.exports = {
resolver: {
sourceExts: [...defaultConfig.resolver.sourceExts, 'cjs'],
},
}; |
We have a different version of metro-config in our project, using RN version 0.61.2. The following worked for me ...
const defaultSourceExts = require('metro-config/src/defaults/defaults').sourceExts
module.exports = {
...
resolver: {
sourceExts: [...defaultSourceExts, 'cjs'],
...
}
} |
Hello ! |
@Thanaen man, just read a comment above yours |
@Thanaen yes. Author just decided to use "standard" extension for non es-modules files. |
I'm getting the following error after using the workaround above using react-native 0.69.5 and expo |
Hei,
I'm trying to plug supertruct to a react-native app, but i'm getting this error
The text was updated successfully, but these errors were encountered: