Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ESM named exports #1843

Closed
1 task done
vadistic opened this issue Nov 2, 2021 · 6 comments
Closed
1 task done

Support ESM named exports #1843

vadistic opened this issue Nov 2, 2021 · 6 comments

Comments

@vadistic
Copy link

vadistic commented Nov 2, 2021

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 🤷‍♂️

@moshest
Copy link

moshest commented Jan 19, 2022

This should fixed that: microsoft/TypeScript#47070

Maybe release an updated version now with the latest TypeScript compiler?

@BenSjoberg
Copy link

@moshest Unfortunately, that fix hasn't landed in a stable TypeScript release yet, so updating won't help. Thankfully it looks like it'll make it into 4.6 (I just tried it in the latest 4.6 dev build) but that's not scheduled to come out until late next month.

@rhnorskov
Copy link

TypeScript 4.6 has now been released, perhaps it worth reopening this issue?

@kamilmysliwiec
Copy link
Member

PR should be auto-created shortly

@moshest
Copy link

moshest commented Mar 4, 2022

Still not working for me at version 10.0.6:

SyntaxError: The requested module '@nestjs/graphql' does not provide an export named 'Args'

@michael-land
Copy link

it would be nice @nestjs/apollo support esm too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants