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

Module entry point "nise.js" is wonky #211

Open
rotu opened this issue Jan 8, 2023 · 5 comments
Open

Module entry point "nise.js" is wonky #211

rotu opened this issue Jan 8, 2023 · 5 comments
Labels

Comments

@rotu
Copy link

rotu commented Jan 8, 2023

package.json lists "module": "nise.js" as an entrypoint, but the nise.js file is a UMD module, not a ES module.

Additionally, the shape of the module when I use a ESM import is wonky. Here's what I get from Node CLI:

>>> await import("nise")
[Module: null prototype] {
  default: {
    fakeServer: {
      // ...
    },
    fakeServerWithClock: {
      // ...
    },
    fakeXhr: {
      // ...
    }
  },
  fakeServer: {
    // ...
  }
}
@fatso83 fatso83 changed the title Module entry point "nise.js" is worky Module entry point "nise.js" is wonky Jan 15, 2023
@fatso83
Copy link
Contributor

fatso83 commented Jan 15, 2023

Hi, thanks for this. The non-standard module field used by some bundlers is supposedly meant to point to a directory of ES Modules. I guess it might as well be better to simply remove it? With regards to the "shape", are you referring to the exported functions being available under the default export, instead of separate exports on the root?

@rotu
Copy link
Author

rotu commented Jan 15, 2023

Yep, the various options are kinda a mess to choose from. I think it should be using main and exports as documented here.

By the “shape”, I mean that fakeServer is the only option available to import by name. Either all 3 named exports should be there or none at all.

Copy link

stale bot commented Dec 27, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 27, 2023
@rotu
Copy link
Author

rotu commented Dec 30, 2023

not stale

@stale stale bot removed the stale label Dec 30, 2023
@fatso83
Copy link
Contributor

fatso83 commented Jan 2, 2024

@mroderick Are you looking at this wrt your current ESM work?

@fatso83 fatso83 added the pinned label Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants