Skip to content

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

Merged
thymikee merged 1 commit intoreact-native-community:mainfrom
tido64:tido/fix-loadconfig-sync
Nov 7, 2024
Merged

fix: loadConfig() failing with "missing loader for extension"#2549
thymikee merged 1 commit intoreact-native-community:mainfrom
tido64:tido/fix-loadconfig-sync

Conversation

@tido64
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

tido64 commented Nov 7, 2024

cc @szymonrybczak

Copy link
Copy Markdown
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
Copy Markdown
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
@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