Skip to content

Commit 9528ab8

Browse files
babel-plugin-relay: Remove assignable fragments
1 parent fcc1ace commit 9528ab8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/babel-plugin-relay/compileGraphQLTag.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ function compileGraphQLTag(
5757
);
5858
}
5959

60+
if (
61+
definition.kind === 'FragmentDefinition' &&
62+
definition.directives &&
63+
definition.directives.some(d => d.name?.value === 'assignable')
64+
) {
65+
// If the fragment is annotated with @assignable,
66+
// the generated artifact isn't exporting anything,
67+
// so we just cleanup the entire graphql tag.
68+
path.remove();
69+
return;
70+
}
71+
6072
const eagerEsModules = state.opts?.eagerEsModules ?? false;
6173
const isHasteMode = state.opts?.jsModuleFormat === 'haste';
6274
const isDevVariable = state.opts?.isDevVariableName;

0 commit comments

Comments
 (0)