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

bug: error while building Named export Websocket not found #1202

Closed
1 task done
softwarecurator opened this issue Sep 14, 2023 · 8 comments
Closed
1 task done

bug: error while building Named export Websocket not found #1202

softwarecurator opened this issue Sep 14, 2023 · 8 comments

Comments

@softwarecurator
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

1.10.12

Current Behavior

Errors while building

node:internal/event_target:1016
  process.nextTick(() => { throw err; });
                           ^
file:///Users/screw/projects/gamblr/gamblronbase/node_modules/unws/src/node.mjs:1
export { WebSocket } from 'ws'
         ^^^^^^^^^
SyntaxError: Named export 'WebSocket' not found. The requested module 'ws' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'ws';
const { WebSocket } = pkg;

Expected Behavior

build correctly lol

Steps To Reproduce

npm run build with latest version of viem

Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.)

No response

Anything else?

No response

@jxom
Copy link
Member

jxom commented Sep 14, 2023

What environment are you running in, and what version of that environment? Node, Bun, Deno, Next.js, etc?

@softwarecurator
Copy link
Author

What environment are you running in, and what version of that environment? Node, Bun, Deno, Next.js, etc?

node, sveltekit with vercel-adapter downgraded to 1.10.9 and was able to to build fine

@jxom
Copy link
Member

jxom commented Sep 14, 2023

Thanks. Taking a look.

@jxom
Copy link
Member

jxom commented Sep 14, 2023

I can't seem to reproduce with my reproduction that mimics your environment (SvelteKit, Node 18, Vercel Adapter). Can you fork my repo and reproduce?

https://github.com/jxom/repro-1202

@Cali93
Copy link

Cali93 commented Sep 14, 2023

I'm facing the same issue using next@13.2.4 with viem@1.10.12
I think this bug was introduced with the new unws dependency.

@jxom
Copy link
Member

jxom commented Sep 14, 2023

Can you please provide a minimal reproducible example?

@jxom
Copy link
Member

jxom commented Sep 14, 2023

Migrated back to isomorphic-ws in f0708c1. Sorry about that.

Should be released in 1.10.13 once build passes.

@jxom jxom closed this as completed Sep 14, 2023
Copy link
Contributor

This issue has been locked since it has been closed for more than 14 days.

If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2024
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

3 participants