When "eagerEsModules": true
is set in a multi-project Relay config, babel-plugin-relay
transforms graphql
tagged templates into require calls, like this:
var _MeQuery;
var MeQuery =
_MeQuery !== void 0
? _MeQuery
: ((_MeQuery = require("./__generated__/MeQuery.graphql")),
_MeQuery.hash &&
_MeQuery.hash !== "bce9f1cc4614c3f306814d78c53b009b" &&
console.error(
"The definition of 'MeQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."
),
_MeQuery);
Just like it does with a single-project Relay config, babel-plugin-relay
should transform graphql
tagged templates into import declarations when "eagerEsModules": true
is set, like this:
import _MeQuery from "../__generated__/MeQuery.graphql";
var MeQuery =
(_MeQuery.hash &&
_MeQuery.hash !== "bce9f1cc4614c3f306814d78c53b009b" &&
console.error(
"The definition of 'MeQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."
),
_MeQuery);
I included the dist files in this repo, but if you want to reproduce the bug yourself, here are the steps:
-
Clone the repo.
-
Run these commands:
npm install npm run build:single npm run build:multi