The plugin hardcodes "Document" and "FragmentDoc" when generating import identifiers for operations and fragments.
This means if you set documentVariableSuffix: '' in your codegen config (a supported option), the plugin generates mismatched imports - it looks for GetUserDocument but codegen exports GetUser.
The upstream codegen has several options that affect variable names:
documentVariablePrefix / documentVariableSuffix
fragmentVariablePrefix / fragmentVariableSuffix
dedupeOperationSuffix
omitOperationSuffix
None of these are currently configurable in the SWC plugin.
I have a PR ready that adds all six options with backwards-compatible defaults.
The plugin hardcodes "Document" and "FragmentDoc" when generating import identifiers for operations and fragments.
This means if you set
documentVariableSuffix: ''in your codegen config (a supported option), the plugin generates mismatched imports - it looks forGetUserDocumentbut codegen exportsGetUser.The upstream codegen has several options that affect variable names:
documentVariablePrefix/documentVariableSuffixfragmentVariablePrefix/fragmentVariableSuffixdedupeOperationSuffixomitOperationSuffixNone of these are currently configurable in the SWC plugin.
I have a PR ready that adds all six options with backwards-compatible defaults.