Skip to content

require() of ES Module from awesome-library\example\metro.config.js not supported. #858

Description

@Alexufo

Description

npx create-react-native-library@latest awesome-library2
√ What is the name of the npm package? ... react-native-awesome-library2
....
√ What type of library do you want to develop? » Turbo module
✔ Project created successfully at awesome-library2!

  1. npx create-react-native-library@latest awesome-library2

  2. npx react-native start inside example folder

E:\awesome-library2\example>yarn react-native start
error require() of ES Module E:\awesome-library2\example\node_modules\react-native-monorepo-config\index.js from E:\awesome-library2\example\metro.config.js not supported.
Instead change the require of index.js in E:\awesome-library2\example\metro.config.js to a dynamic import() which is available in all CommonJS modules.
Error [ERR_REQUIRE_ESM]: require() of ES Module E:\awesome-library2\example\node_modules\react-native-monorepo-config\index.js from E:\awesome-library2\example\metro.config.js not supported.
Instead change the require of index.js in E:\awesome-library2\example\metro.config.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (E:\awesome-library2\example\metro.config.js:3:29)
    at module.exports (E:\awesome-library2\example\node_modules\cosmiconfig\node_modules\import-fresh\index.js:28:9)
    at loadJs (E:\awesome-library2\example\node_modules\cosmiconfig\dist\loaders.js:9:18)
    at Explorer.loadFileContent (E:\awesome-library2\example\node_modules\cosmiconfig\dist\createExplorer.js:230:12)
    at E:\awesome-library2\example\node_modules\cosmiconfig\dist\createExplorer.js:252:21

Packages

  • create-react-native-library
  • react-native-builder-bob

Selected options

latest

Link to repro

/

Environment

windows 10

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions