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

fix: loadConfig() failing with "missing loader for extension" #2549

Merged

Conversation

tido64
Copy link
Contributor

@tido64 tido64 commented Nov 7, 2024

Summary:

loadConfig() failing with "missing loader for extension":

Error: Missing loader for extension "react-native.config.mjs".
    at #validateConfig (/~/node_modules/cosmiconfig/dist/ExplorerBase.js:37:23)
    at new ExplorerBase (/~/node_modules/cosmiconfig/dist/ExplorerBase.js:25:29)
    at new ExplorerSync (/~/node_modules/cosmiconfig/dist/ExplorerSync.js:16:1)
    at cosmiconfigSync (/~/node_modules/cosmiconfig/dist/index.js:138:26)
    at readConfigFromDisk (/~/node_modules/@react-native-community/cli-config/build/readConfigFromDisk.js:65:55)

Test Plan:

This is enough to trigger the error:

node -p 'require("@react-native-community/cli").loadConfig({})'

Checklist

  • Documentation is up to date to reflect these changes.
  • Follows commit message convention described in CONTRIBUTING.md

@tido64
Copy link
Contributor Author

tido64 commented Nov 7, 2024

cc @szymonrybczak

Copy link
Collaborator

@szymonrybczak szymonrybczak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woah, thank you for fixing it 🙏

@szymonrybczak
Copy link
Collaborator

I wonder if we should add tests against loadConfig() function (reuse our old tests) 🤔

@thymikee thymikee changed the title fix: fix loadConfig() failing with "missing loader for extension" fix: loadConfig() failing with "missing loader for extension" Nov 7, 2024
@thymikee thymikee merged commit 4bf6ecd into react-native-community:main Nov 7, 2024
4 of 10 checks passed
@tido64 tido64 deleted the tido/fix-loadconfig-sync branch November 7, 2024 15:30
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

Successfully merging this pull request may close these issues.

3 participants