-
Notifications
You must be signed in to change notification settings - Fork 57
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
Duplicate __self prop found #198
Comments
I tracked down the code and might be related to this line: |
Tried commenting out the L16:L17 and it fixed the issue for me. Do you think it's still relevant to pull the dev version of |
DescriptionSeeing the same error as @matinzd however on a standard react native app created from the react-native-cli. [error] src/App.tsx: /Users/**/Workspace/my-app/src/App.tsx: Duplicate __self prop found. You are most likely using the deprecated transform-react-jsx-self Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.
41 | }}>
42 | <PortalProvider>
> 43 | <Navigation />
| ^^^^^^^^^^^^^^
44 | <Calendar />
45 | <PortalHost name={BOTTOM_SHEET_PORTAL} />
46 | {/* {__DEV__ ? null : ( babel.config.jsmodule.exports = {
presets: ['module:@react-native/babel-preset'],
plugins: ['react-native-reanimated/plugin'],
}; metro.config.jsconst {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
const defaultConfig = getDefaultConfig(__dirname);
const {assetExts, sourceExts} = defaultConfig.resolver;
/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
*
* @type {import('metro-config').MetroConfig}
*/
const config = {
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer'),
},
resolver: {
assetExts: assetExts.filter(ext => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg'],
},
};
module.exports = mergeConfig(defaultConfig, config); EnvironmentReact Native IDE: 0.0.9 |
Same Error : babel.config.js
metro.config.js
Environment React Native IDE: 0.0.9 |
I have the same error on my personal project, but not the company one. Dependencies are the same, but in one App.tsx is in the root, in the other in the Not related to code btw, because removing everything and leaving the app with only a |
Something to add here same as @Martinocom. My app entrypoint is located under entryFile = file("../../src/main.tsx")
|
same issue as above on iOS builds |
Fixes #198 This is another approach at resolving the complexity of enabling development JSX transforms. As noted in #198 the old approach would sometimes produce an error that the development transform throws when other instance of dev JSX transform run, or when some of jsx-self or jsx-source transforms are run on the same file along with the jsx dev version. The problem in the repro provided in #198 was due to the use of quite popular react-native-svg-transformer which doesn't forward `plugins` attribute to the upstream transformer. I proposed a fix for this issue in that repo kristerkari/react-native-svg-transformer#354 however, it isn't practical to wait for a fix there and hence the PR implements another workaround that doesn't depend on the `plugins` attribute of the transformer. The new approach relies on additional flag that is turned on when non-dev version of the plugin is loaded. What we try to achieve is that only jsx-dev transform is listed as plugin, and other varians (non-dev, -self, and -source) versions are all turned off. Since we can't hijack the plugins list, the only option is to use require overwrites. Furthermore, we need to consider the case when someone has a proper setup where only dev transform is listed and others are not. If we were to only overwrite non-deb with dev version, that wouldn't suffice for this particular case. What we now do is: 1) disable -self and -source transforms entirely (read inline comment for details on why we can do it) 2) replace non-dev JSX transform with dev version, and also use a flag to mark when this replaced non-dev version is used 3) replace dev JSX transform with extra logic that checks for the flag that marks whether non-dev version is used. If it is used, we return an empty transform. Otherwise, we just return the dev transform as it means that non-dev isn't registered. As stated in the inline comment, this approach would break if someone has dev transform registered before non-dev. Apparently, I don't see a better way to move forward with this approach and I'd hope that the current solution would cover the majority of setups.
This issue turned out to be a problem with svg transformer: https://github.com/matinzd/react-native-ide-nx-repro/blob/main/apps/react-native-ide-nx-repro-mobile/metro.config.js#L15 The transformer wasn't forwarding some of the properties to the upstream version of transformer and I submitted a PR to fix that here: kristerkari/react-native-svg-transformer#354 I also found another way to workaround this issue without the need for a fix in svg transformer. Can other people here confirm that you've been using that transformer in your setups? |
I can confirm we were using |
I was running into this issue and I can confirm that I am also using |
Hi. How did you commented it? I'm facing this issue even if I installed |
Description
After building the app, when metro tries to bundle the app it fails with the following error:
Might be related to monorepo stuff since I am using NX.
Metro Config:
My babel config:
Screenshot
Environment
React Native IDE: 0.0.9
React Native: 0.74.0
The text was updated successfully, but these errors were encountered: