You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the --isolatedModules webpack flag, each file must have at least one import/export. This flag is set by default when using frameworks such as next.js. Typescript codegen can produce empty type files, causing the build to break for projects that use this flag.
yarn run v1.15.2
$ next build
Creating an optimized production build
Failed to compile.
/project/src/types/gqlTypes.ts
ERROR in /project/src/types/gqlTypes.ts(1,1):
1:1 All files must be modules when the '--isolatedModules' flag is provided.
> 1 | /* tslint:disable */
| ^
2 | /* eslint-disable */
3 | // @generated
4 | // This file was automatically generated and should not be edited.
Currently I need to manually put the following at the end of each file.
exportdefault{};
Would it be possible to do this as part of codegen?
I got around this issue with the setting --globalTypesFile src/__generated-globals__/globalTypes.d.ts. This means you won't need to manually add that line each time you generate your client.
When using the
--isolatedModules
webpack flag, each file must have at least one import/export. This flag is set by default when using frameworks such asnext.js
. Typescript codegen can produce empty type files, causing the build to break for projects that use this flag.Currently I need to manually put the following at the end of each file.
Would it be possible to do this as part of codegen?
P.S. Here is a stackoverflow thread about this issue: https://stackoverflow.com/questions/56577201/why-is-isolatedmodules-error-fixed-by-any-import/56577324
The text was updated successfully, but these errors were encountered: