Open prztrz opened 5 years ago
Run into the same issue. Any solutions?
I found two options to get this working. Apollo codegen can't find the fragments schema because it's not in the search path.
I went with the second option because I still want the global types separated for each package. This is my apollo config for the app that wants to import the fragments:
module.exports = {
client: {
addTypename: true,
includes: [
'./App/**/*.{ts,tsx,js,jsx,graphql}',
'./node_modules/mypackage/src/**/*.{ts,tsx,js,jsx,graphql}',
],
exclude: ['./**/*.mocks.{ts,tsx,js,jsx,graphql}'],
},
},
};
The only caveat is now that it generates the types for my includes package schemas too every time I run codegen on the app. Nice would be an option like external schemas where it's posible to import external schema defenitions.
The issue is apollo codegen throw
UnkonwFragment
error if fragment is imported from other package.Intended outcome:
One of my monorepo packages exports fragment field on exported react component like here:
so after building (just ts compiler) I want to use this package:
I expected that runing apollo codegen in application will generate proper type for
data
prop inApp
. Regardless this code works fine and data is fetched exactly as expected.Actual outcome: Instead of proper code generation i got `unkown fragment error:
Versions