Skip to content

feat!: migrate to esm only - #281

Open
nicolas-marien wants to merge 1 commit into
robtaussig:masterfrom
nicolas-marien:master
Open

feat!: migrate to esm only#281
nicolas-marien wants to merge 1 commit into
robtaussig:masterfrom
nicolas-marien:master

Conversation

@nicolas-marien

Copy link
Copy Markdown

Migrate the package to ESM only.

We are using your library, I am trying to use vite 8, and I ran into some interop issue.

This is a breaking change.

Thank you!

@ddcech

ddcech commented Mar 13, 2026

Copy link
Copy Markdown

We also see this library breaking in vite 8, but i don't think rewriting every import statement with .js is the correct solution here.

@nicolas-marien

Copy link
Copy Markdown
Author

I would say that the most important changes are in the package.json and tsconfig.
We could keep the import as they are with a moduleResolution: bundler I guess. But given the amount of code there is, I feel updating the import to be as compliant as possible is okay.

@ilamuhil

Copy link
Copy Markdown

Hi, is there an update on this issue?

I am having to replace my imports like this but my workaround is not ideal.
import { useWebSocket } from 'react-use-websocket/dist/lib/use-websocket'

@ilamuhil

Copy link
Copy Markdown

We also see this library breaking in vite 8, but i don't think rewriting every import statement with .js is the correct solution here.

How would you ensure compatibility with CJS and ESM modules without renaming the imports suffixed with .js?

@ddcech

ddcech commented Jul 27, 2026

Copy link
Copy Markdown

@ilamuhil we dropped this library entirely for a simple, custom, no dependency implementation using useSyncExternalStore from react as the boundary.

This library is an antipattern to begin with; websocket data transport and react focus on two very different things in your frontend stack.

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

Successfully merging this pull request may close these issues.

3 participants