Search code examples
typescriptrelayjs

How to extends ts language plugin in relay 13


In our project, we are using relay-compiler along with relay-compiler-language-typescript to add some code to generated queries.

We would like to upgrade to relay 13.

How can I replace the part of the code where we use relay-compiler-language-typescript?

import { relayCompiler } from 'relay-compiler';



// how can we replace this
const tsPluginDefault = require('relay-compiler-language-typescript').default();
const { inputExtensions, outputExtension, findGraphQLTags, typeGenerator } = tsPluginDefault;



const specificFormatModule = ourSpecificThings // we add some code to the generated output files 

const langPlugin = {
    inputExtensions,
    outputExtension,
    findGraphQLTags,
    formatModule: specificFormatModule,
    typeGenerator,
}

await relayCompiler({
    ...moreConfig,
    language: langPlugin,
});



Solution

  • A relay contributor answered me on discord and said that relay 13 does not support yet adding custom transforms