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

ESM module export not used by node #6

Open
richardscarrott opened this issue May 18, 2022 · 3 comments
Open

ESM module export not used by node #6

richardscarrott opened this issue May 18, 2022 · 3 comments
Labels

Comments

@richardscarrott
Copy link
Owner

Think it a) needs "exports" and b) needs .mjs extension, that way older versions can continue to load the cjs version.

e.g.

"module": "dist/ok-computer.esm.mjs",
  "types": "dist/ok-computer.d.ts",
  "exports": {
    ".": {
      "import": "./dist/ok-computer.esm.mjs",
      "require": "./dist/ok-computer.esm.mjs",
      "types": "./dist/ok-computer.d.ts"
    }
  },

Not sure if it's ok to have "module" with an mjs path?

@richardscarrott
Copy link
Owner Author

Additionally, current master has this

import * as parser from "ok-computer/dist/cjs/parser";

Instead of

import * as p from "ok-computer/parser";

@unsaved
Copy link

unsaved commented Oct 21, 2023

This Issue is still open but I'm able to successfully load ok-computer from Node CommonJS require; from Node ES6 import...from; and from Deno. What is the case that isn't supported?

@richardscarrott
Copy link
Owner Author

All environments are supported, however the ESM build isn't being used by Node as I had expected. It instead was pulling in the CJS build. Not really a big deal but a bug nonetheless.

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