graphql-mesh icon indicating copy to clipboard operation
graphql-mesh copied to clipboard

Add `.js` extension for artifacts import (ESM compatability)

Open gilgardosh opened this issue 3 years ago • 1 comments

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • [ ] 2. A failing test has been provided
  • [ ] 3. A local solution has been provided
  • [ ] 4. A pull request is pending review

Describe the bug

Bundling a package with Mesh artifacts as ESM results in error, since the hardcoded paths in the artifacts are missing .js extension

To Reproduce Steps to reproduce the behavior:

  1. Create a basic Mesh example with local sources (e.g the json-schema-example)
  2. Generate artifact
  3. Create ESM bundle
  4. Try to run the bundled artifact

Expected behavior

Bundled artifacts should fully support ESM

gilgardosh avatar Jan 16 '23 12:01 gilgardosh

ESM is currently supported. with the NODE_OPTIONS=\"--loader ts-node/esm\" mesh build command. @ardatan can we maybe migrate this var to the configuration file?

gilgardosh avatar Sep 28 '23 16:09 gilgardosh