brillout / telefunc

Remote Functions. Instead of API.
https://telefunc.com
MIT License
690 stars 31 forks source link

[BUG] Cannot find module 'telefunc/react-streaming' or its corresponding type declarations. #76

Closed VienDinhCom closed 1 year ago

VienDinhCom commented 1 year ago

Hi @brillout,

I find this bug when try to import telefunc/react-streaming.

import { useData } from 'telefunc/react-streaming';

Error: Cannot find module 'telefunc/react-streaming' or its corresponding type declarations.

By the way, vite, vite-plugin-ssr, telefunc and react-streaming are awesome. I really like them ❤

brillout commented 1 year ago

The example at /examples/react-streaming/ is working and uses that import, so I'm not sure why it doesn't work for you.

I'll need a reproduction.

By the way, vite, vite-plugin-ssr, telefunc and react-streaming are awesome. I really like them ❤

I'm glad you like them. In case you're able to convince your employer: https://github.com/sponsors/brillout — it makes a big difference!

VienDinhCom commented 1 year ago

Hi @brillout,

I noticed that the react-streaming is missing in the node_modules/telefunc directory, which could be the cause of the issue.

Here is a screenshot showing the missing package:

image

I am currently using your libraries to build my stack, and if they work perfectly, I would be happy to promote them within the JavaScript community in Vietnam.

Thank you!

brillout commented 1 year ago

I noticed that the react-streaming is missing in the node_modules/telefunc directory, which could be the cause of the issue.

It's a peer dependency: make sure to install it.

I am currently using your libraries to build my stack, and if they work perfectly, I would be happy to promote them within the JavaScript community in Vietnam.

💯

VienDinhCom commented 1 year ago

I can assure you that I have the react-streaming package installed.

Currently, I have to import the useData hook lie this:

import { useData } from 'telefunc/dist/esm/shared/react-streaming/useData';

Updated: Importing like this doesn't work.

brillout commented 1 year ago

I'll need a reproduction.

VienDinhCom commented 1 year ago

Environment

I used volta to install node and npm.

Node: 18.16.1 NPM: 9.5.1 OS: Ubuntu 22.04

Example

https://github.com/brillout/telefunc/tree/main/examples/react-streaming

Dependencies

I must install dependencies with the command below, because there is a problem: Fix the upstream dependency conflict, or retry this command with --force or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.

npm i --force

Status

The bug is also in your example:

image

brillout commented 1 year ago

Fix released in 0.1.58.

VienDinhCom commented 1 year ago

It works! Thank you!