Skip to content
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

[ERROR] No matching export in "node_modules/react-native-screens/src/index.native.tsx" for import "isSearchBarAvailableForCurrentPlatform" #33

Open
ko-devHong opened this issue Sep 20, 2023 · 8 comments

Comments

@ko-devHong
Copy link

ko-devHong commented Sep 20, 2023

I tried to run it after changing thereact-native-config.js setting after a normal installation, but an error occurs during compilation.

스크린샷 2023-09-20 오전 9 16 28
  • react-native.config.js
const { createEsbuildCommands, defaultHasFlowSyntax, syntaxAwareLoaderPlugin } = require("react-native-esbuild");

const FLOW_MODULES_WITHOUT_PRAGMA = ["react-native-appsflyer"];

const commands = createEsbuildCommands((config, args) => ({
    ...config,
    plugins: config.plugins
        .filter(plugin => plugin.name !== "syntax-aware-loader")
        .concat(
            syntaxAwareLoaderPlugin({
                filter: /\.([mc]js|[tj]sx?)$/,
                cache: args.dev,
                hasFlowSyntax: (contents, filePath) =>
                    defaultHasFlowSyntax(contents, filePath) ||
                    FLOW_MODULES_WITHOUT_PRAGMA.find(m => filePath.includes(`node_modules/${m}/`))
            })
        )
}));

module.exports = {
    commands,
    project: {
        ios: {},
        android: {}
    },
    assets: ["./src/assets/fonts/"],
    dependencies: {
        ...(process.env.NO_FLIPPER ? { "react-native-flipper": { platforms: { ios: null } } } : {})
    }
};
  • package.json
{
 ...
 "react-native-screens": "^3.19.0",
 "@react-navigation/bottom-tabs": "^6.3.1",
 "@react-navigation/elements": "^1.3.13",
 "@react-navigation/material-top-tabs": "^6.2.2",
 "@react-navigation/native": "^6.1.2",
 "@react-navigation/native-stack": "^6.9.8",
 "react-native": "0.71.1",
}

My guess is that I don't support esm.

@ko-devHong
Copy link
Author

ko-devHong commented Sep 20, 2023

I changed library code.

스크린샷 2023-09-20 오전 11 47 55

But it is not work

@ko-devHong
Copy link
Author

ko-devHong commented Sep 21, 2023

@oblador how can I solve this problem?
I think it's a similar situation to the link issue below but I have too much to change the code in the library.
evanw/esbuild#890

@LeoInCode
Copy link

I have the same experience. Idk more what I have to do. I think could be:

  • When run "react-native esbuild-start", they cannot see tsconfig.json
  • After running, "react-native-.config.js" file don't execute metro, so, they cannot understand this modules

I visited many sites, looked all files of this library, and other projects who used this library, but no one could resolve.

@oblador , we need an answer about that!

@oblador
Copy link
Owner

oblador commented Dec 7, 2023

To my understanding this is rooted in re-exporting types. I believe replacing them with explicit export/import type where needed solves it.

@oblador
Copy link
Owner

oblador commented Dec 7, 2023

Regardless, if you want my help i need a minimal code example reproducing the error

@LeoInCode
Copy link

Yeah, I understand your explanation, but I cannot modify all my files of node_modules to adapt to this. Also, I discovered that this error is originally from esbuild. So, as you use that, you inherited this error.

@oblador
Copy link
Owner

oblador commented Dec 10, 2023

node_modules in absolute majority of cases will ship transpiled code. I've worked in very large code bases and encountered this problem (which is not specific to just esbuild actually), but never in a third party lib. If it indeed is the case that they are only shipping TS, it's possible to patch it with patch-package or similar.

@LeoInCode
Copy link

But a patch-package for one by one of the erros, in the start of the project, is a shot in the foot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants