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

Error on TypeScript build: standard modules has no default export #381

Closed
frankie567 opened this issue Jun 7, 2018 · 5 comments
Closed
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@frankie567
Copy link

frankie567 commented Jun 7, 2018

Hi,

I'm currently building a TypeScript project using googleapis library (version 32.0.0, with google-auth-library version 1.6.0). Whenever I try to build my project, here are the errors I get:

node_modules/google-auth-library/build/src/auth/googleauth.d.ts(18,8): error TS1192: Module '"fs"' has no default export.
node_modules/google-auth-library/build/src/auth/googleauth.d.ts(19,8): error TS1192: Module '"http"' has no default export.
node_modules/google-auth-library/build/src/auth/googleauth.d.ts(20,8): error TS1192: Module '"stream"' has no default export.
node_modules/google-auth-library/build/src/auth/jwtaccess.d.ts(17,8): error TS1192: Module '"stream"' has no default export.
node_modules/google-auth-library/build/src/auth/jwtclient.d.ts(18,8): error TS1192: Module '"stream"' has no default export.
node_modules/google-auth-library/build/src/auth/oauth2client.d.ts(18,8): error TS1192: Module '"http"' has no default export.
node_modules/google-auth-library/build/src/auth/refreshclient.d.ts(17,8): error TS1192: Module '"stream"' has no default export.

It seems that TypeScript expects the import * as http from 'http' syntax for the standard modules.

I tried with both TypeScript 2.8 and 2.9, same issue. Node version: 8.11.

Could you look into this? Is there something wrong with my build configuration?

Best regards,

François Voron

@nolanmar511
Copy link
Contributor

I'm seeing the same issue on continuous tests for @google-cloud/profiler with node 6, and can reproduce locally with node 8 and 10 when I modify the project's package-lock.json to use v1.6.0. I'm using typescript 2.8

I think there's a problem with v1.6.0

@JustinBeckwith JustinBeckwith self-assigned this Jun 7, 2018
@JustinBeckwith JustinBeckwith added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jun 7, 2018
@JustinBeckwith
Copy link
Contributor

Taking a first look. Can you try running your TypeScript compiler with --esModuleInterop to see if that fixes the issue?

@JustinBeckwith
Copy link
Contributor

cc @ofrobots @google/google-node-team

@JustinBeckwith
Copy link
Contributor

esModuleInterop was introduced as a default for gts here. We upgraded to gts@0.6, which included the move to synthetic imports in #372. Still figuring out what's up.

@frankie567
Copy link
Author

Yes, setting the esModuleInterop flag to true solves the issue.

@jkwlui jkwlui removed priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. in progress labels Jun 7, 2018
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

5 participants