Skip to content

Support ESM named exports #1843

@vadistic

Description

@vadistic

Did you read the migration guide?

- [ ] I have read the whole migration guide

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Potential Commit/PR that introduced the regression

No response

Versions

9.1.1

Describe the regression

Exactly the same issue as nestjs/nest#8320 for core packages

For core packages upgrade to 8.1.1+ fixes it, for nestjs/graphql - current verison 9.1.1 still hast this issue.

import { Query, Resolver } from '@nestjs/graphql';
         ^^^^^
SyntaxError: Named export 'Query' not found. The requested module '@nestjs/graphql' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@nestjs/graphql';
const { Query, Resolver } = pkg;

Minimum reproduction code

import { Query, Resolver } from '@nestjs/graphql'

in project with package type: "module" and target: "esnext"

Expected behavior

Node ESM named import works.

Other

I did not see the issue about it 🤷‍♂️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions