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

Fix cluster import #2022

Merged
merged 1 commit into from
Nov 23, 2021
Merged

Fix cluster import #2022

merged 1 commit into from
Nov 23, 2021

Conversation

evantahler
Copy link
Member

@evantahler evantahler commented Nov 23, 2021

The changes made in #2014 around the cluster module need to be reverted. The @types for this package are incorrect. Crazy!

// not working

import cluster from "cluster";
console.log(cluster); // --> undefined

// working
import * as cluster from "cluster";
console.log(cluster); // --> 

EventEmitter {
  _events: [Object: null prototype] {},
  _eventsCount: 0,
  _maxListeners: undefined,
  isWorker: false,
  isMaster: true,
  isPrimary: true,
  Worker: [Function: Worker],
  workers: {},
  settings: {},
  SCHED_NONE: 1,
  SCHED_RR: 2,
  schedulingPolicy: 2,
  setupPrimary: [Function (anonymous)],
  setupMaster: [Function (anonymous)],
  fork: [Function (anonymous)],
  disconnect: [Function (anonymous)],
  [Symbol(kCapture)]: false
}

@evantahler evantahler added the bug Something isn't working label Nov 23, 2021
@evantahler
Copy link
Member Author

cc @krishnaglick - nuts!

@evantahler evantahler merged commit 6f8ac3a into main Nov 23, 2021
@evantahler evantahler deleted the fix-cluster branch November 23, 2021 02:33
@krishnaglick
Copy link
Collaborator

Probably worth adding esModuleInterop to tsconfig

@evantahler
Copy link
Member Author

I don’t think that was the issue though - in this case the types provided by @types/node were wrong. Usually, with the other builtins like fs, path, etc know about the different import styles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants