Flow throws an error when generating artifacts with --eagerESModules
and @refetchable
:
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ __generated__/bugRelayUseRefetchableFragmentFlow.graphql.js:36:20
Cannot assign object literal to node because property bugRelayUseRefetchableFragmentFlowQuery is missing in
ConcreteRequest [1] but exists in module ./bugRelayUseRefetchableFragmentFlowQuery.graphql.js [2] in property
metadata.refetch.operation. [incompatible-type]
__generated__/bugRelayUseRefetchableFragmentFlow.graphql.js
33│ "refetch": {
34│ "connection": null,
35│ "fragmentPathInResult": [],
[2] 36│ "operation": require('./bugRelayUseRefetchableFragmentFlowQuery.graphql.js')
37│ }
38│ },
39│ "name": "bugRelayUseRefetchableFragmentFlow",
node_modules/relay-runtime/util/ReaderNode.js.flow
[1] 68│ +operation: string | ConcreteRequest,
Found 1 error
yarn install
yarn run relay-compiler --src=. --schema=schema.graphql --eagerESModules
yarn run flow
💥
The artifact could be generated with require(…).default
when using --eagerESModules
option like so:
"metadata": {
"refetch": {
"connection": null,
"fragmentPathInResult": [],
- "operation": require('./bugRelayUseRefetchableFragmentFlowQuery.graphql.js')
+ "operation": require('./bugRelayUseRefetchableFragmentFlowQuery.graphql.js').default
}
}
(no Flow errors)