Skip to content

Rollup errors when used with Nuxt 4 and Nuxt 3 in compatibility mode 4 #217

@GerryWilko

Description

@GerryWilko

Hello,

Thank you so much for a great Nuxt module been really enjoying using it.

I seem to have run into an issue in Nuxt 4 where we get rollup errors related to the graphql-server-resolver.d.ts trying to be bundled by Rollup but it fails as it is a TS file and shouldn't be being bundled.

I believe the issue is that addTemplate is being used to add this file to the Nitro server but according to this, it seems addServerTemplate should be being used?

})
const resolverTypesTemplateName = 'types/graphql-server-resolver.d.ts'
const { dst: resolverTypeDefPath } = addTemplate({
filename: resolverTypesTemplateName,
getContents: () => {

Error:

[nitro 9:06:05 AM]  ERROR  RollupError: node_modules/.cache/nuxt/.nuxt/types/graphql-server-resolver.d.ts (3:7): Expected '{', got 'type' (Note that you need plugins to import files that are not JavaScript)


1: import { GraphQLResolveInfo } from 'graphql';
2: import { GraphQLContext } from '../../../../../server/graphql/context';
3: export type Maybe<T> = T | null;
          ^
4: export type InputMaybe<T> = Maybe<T>;
5: export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };


[9:06:05 AM]  ERROR  node_modules/.cache/nuxt/.nuxt/types/graphql-server-resolver.d.ts (3:7): Expected '{', got 'type' (Note that you need plugins to import files that are not JavaScript)

  [cause]: Expected '{', got 'type'

[9:06:05 AM]  ERROR  node_modules/.cache/nuxt/.nuxt/types/graphql-server-resolver.d.ts (3:7): Expected '{', got 'type' (Note that you need plugins to import files that are not JavaScript)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions