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 Import Error #30

Open
rlee1990 opened this issue Oct 12, 2022 · 7 comments
Open

ESM Import Error #30

rlee1990 opened this issue Oct 12, 2022 · 7 comments
Milestone

Comments

@rlee1990
Copy link

I keep getting the below error when trying to use this package with Deno via ESM.SH.

/* esm.sh - error */
throw new Error("[esm.sh] " + "parseCJSModuleExports: Can't resolve 'ws' in '/tmp/esm-build-22c48223b295c5ba9976ebd601dab8cc371bc315-87cf645d/node_modules/isomorphic-ws'");
export default null;
@heineiuo
Copy link
Owner

@rlee1990 Can you provide a simple repo to present this error?

@rlee1990
Copy link
Author

@heineiuo there is no repo because it won't compile. You can just type ram.sh/ the package name in the web browser and you will see the error

@heineiuo
Copy link
Owner

It looks like esm.sh does not respect peerDependencies or there maybe some arguments to support peerDependencies.

@rlee1990
Copy link
Author

It looks like esm.sh does not respect peerDependencies or there maybe some arguments to support peerDependencies.

Any way to get around this or to get it all working?

@rlee1990
Copy link
Author

rlee1990 commented Nov 1, 2022

Any update @heineiuo

@JoCat
Copy link

JoCat commented Dec 5, 2022

apparently due to the fact that the library does not have an exported file for esm and an error occurs

@monsterbitar
Copy link

monsterbitar commented Jun 16, 2023

To address this problem:

  1. create an ESM compatible version node.mjs file:
"use strict";

export * from 'ws';
  1. Update the package.json file to replace:
  "browser": "browser.js",

with:

  "exports": {
    "browser": "./browser.js",
    "import": "./node.mjs",
    "require": "./node.js"
  },

then add the new node.mjs file in the "files" section.

This was referenced Jun 16, 2023
@heineiuo heineiuo added this to the v6 milestone Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants