Open
Description
Describe the bug
Mesh errors on build once package.json contains "type": "module
Failed to generate schema: require() of ES Module .../graphql-mesh/examples/odata-msgraph-programmatic/.mesh/sources/Microsoft Graph/metadata.json.js from .../graphql-mesh/examples/odata-msgraph-programmatic/node_modules/@graphql-mesh/cli/bin.js not supported.
metadata.json.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename metadata.json.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in .../graphql-mesh/examples/odata-msgraph-programmatic/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
To Reproduce
Steps to reproduce the behavior:
- Take an example from the repo, such as
odata-msgraph-programmatic
. - Add
"type": "module"
to the package.json - run
mesh build
- error thrown
Expected behavior
Build with no issues :)
Metadata
Metadata
Assignees
Labels
No labels