perry-mitchell / webdav-client

WebDAV client written in Typescript for NodeJS and the browser
MIT License
661 stars 143 forks source link

React-Native import fails #366

Closed FengFuLiu closed 5 months ago

FengFuLiu commented 7 months ago

show error when i import webdav/react-native

FengFuLiu commented 7 months ago

4ba2cb8df2eff760a90d1daac8cec9d2

ihwf commented 7 months ago

react-native can not use @perry-mitchell

import { AuthType, createClient } from 'webdav/dist/react-native'

const client = createClient('https://dav.jianguoyun.com/dav/', {
  authType: AuthType.Password,
  username: 'xxxx',
  password: 'xxxxx',
})

will error with [Error: Exception in HostFunction: Compiling JS failed: 1238:15:unrecognized Unicode character \u2118 Buffer size 305861 starts with: 5f5f642866756e6374696f6e2028676c and has protection mode(s): rw-p]

image

ihwf commented 7 months ago

use from webdav/dist/web is work😂

perry-mitchell commented 6 months ago

It's actually import {} from "webdav/react-native", no need for the dist. And even just importing from"webdav"should work as we have thereact-native` entry in the package.json. I'm using that here.

Can you try just importing webdav directly?

ihwf commented 6 months ago

from "webdav" not work, throw this image and if from "webdav/react-native", it throw Unable to resolve "webdav/react-native" BTW: use "react-native": "0.73.4", "webdav": "^5.5.0"

Lucas-vdr-Horst commented 5 months ago

I have the same problem. Were you able to solve this?

perry-mitchell commented 5 months ago

All the issues I'm currently seeing here point to the fact that this library uses references on both sides (node/web) that simply won't work on RN. On the web side we have document references, and on the node side we have http agent references. Neither will ever work.

I'm trying to figure out how to bypass this issue now.

perry-mitchell commented 5 months ago

Please see updated docs: https://github.com/perry-mitchell/webdav-client?tab=readme-ov-file#react-native-support