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

apollo-server: Module '"http"' has no default export. #1189

Closed
danilobuerger opened this issue Jun 18, 2018 · 3 comments
Closed

apollo-server: Module '"http"' has no default export. #1189

danilobuerger opened this issue Jun 18, 2018 · 3 comments

Comments

@danilobuerger
Copy link
Contributor

When using apollo-server with Typescript, the following error is produced:

node_modules/apollo-server/dist/index.d.ts:2:8 - error TS1192: Module '"http"' has no default export.
2 import http from 'http';
         ~~~~
error Command failed with exit code 2.

Version

"apollo-server": "2.0.0-rc.0"
"typescript": "2.9.2"

tsconfig

{
  "compilerOptions": {
    "target": "es2017",
    "module": "commonjs",
    "moduleResolution": "node",
    "lib": ["es2017", "esnext.asynciterable"],
    "outDir": "./build"
  },
  "include": ["src/**/*.ts"],
  "exclude": ["node_modules"]
}
@danilobuerger
Copy link
Contributor Author

The same seems to be true for the following:

node_modules/apollo-server-core/dist/types.d.ts:4:8 - error TS1192: Module '"node_modules/@types/ws/index"' has no default export.
4 import WebSocket from 'ws';
         ~~~~~~~~~
node_modules/apollo-server-express/dist/ApolloServer.d.ts:1:8 - error TS1192: Module '"node_modules/@types/express/index"' has no default export.
1 import express from 'express';
         ~~~~~~~
node_modules/apollo-server-express/dist/ApolloServer.d.ts:2:8 - error TS1192: Module '"node_modules/@types/cors/index"' has no default export.
2 import corsMiddleware from 'cors';
         ~~~~~~~~~~~~~~

@evans
Copy link
Contributor

evans commented Jun 20, 2018

This can be fixed by setting esModuleInterop: true. We have a longer discussion on #1182

@evans evans closed this as completed Jun 20, 2018
@danilobuerger
Copy link
Contributor Author

Thanks @evans ! That worked.

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

No branches or pull requests

2 participants