-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
Cannot import processResponsePayload
from webdav/dist/node/response.js
#339
Comments
Hi @skjnldsv - So sorry I didn't get back to you sooner.. A full quarter later. If you're still having this issue I'd be more than happy to make the necessary modifications for you to be able to continue making custom requests. Let me look into this for you. |
Regarding these lines: https://github.com/nextcloud/server/blob/2afe26726bb48f78ef80ef1549834160121caaa4/apps/comments/src/services/GetComments.js#-L63-L64 You probably don't need That being said, I'm going to expose it and release a new version so you can continue to use it as-is. Hopefully that's enough - please let me know if you require something additional. |
Released under 5.2.1 |
Thank you!! :) |
Ah, it seems t still misbehave
|
Fix in #345 |
Might I ask though, why you're importing from the If you just I'll hold the release until I hear back sorry - want to make sure there's not some misunderstanding here :) |
We're bundling everything though webpack, so browser or node should not matter that much I think :) Like on this specific example above, how could I replace the request method without importing from the |
Ok.. interesting. I'm not sure how Nextcloud server works under the hood, but it seems strange that you're using Webpack to build it when it's supposedly run on Node? Why not just build it using Typescript? Webpack in this case is trying to resolve via the browser manifest in package.json, which is wrong, if you're building a node app. If it's web it's fine and then you could just import from "webdav". Node should be imported from the same and when the environment is correct, it will resolve using "exports" or "main" in package.json. Any chance that you don't have "target" set in your Webpack config? I wonder if, when set to "node", if this would change how Webpack resolves package.json dependencies 🤔. Apologies if I've misunderstood something/everything.. the setup seems strange to me, that's all :) |
The setup is very standard actually, (We also have babel transpiling any code that would be incompatible with the range of browsers we desire) https://webpack.js.org/guides/package-exports/#target-environment |
Btw, generally speaking, there is fewer and fewer people running libraries straight from their browsers. We're maintaining a fair amount of libs at Nextcloud, and we only export esm and cjs packages. It's far simpler to consider an npm dependency as a library only instead of a runtime/library combo in my honest opinion :) |
Yes, but the original code linked was for nextcloud server, which doesn't run in the browser, right? Ie here:
I'm aware :) - I use webpack liberally, but not for server-side libraries. I just compile ts => js using So.. am I right in assuming that the repo is a monolith of projects and you just use webpack to simplify the building of all of them? If so, then I can see the import being a problem. Would it work for you if I removed the other paths in |
Oh, it's misleading, my bad, yes; server includes both the backend and the frontend :)
Kind of yeah :)
I have never seen exports like you did here, and I'm lacking expertise on the subject. "main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
}, Some do decide to go esm only, like this famous developer with many used libs: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c |
Yeah. To be honest these hybrid outputs like In your example now you show only |
I think you're right and this is the safest way :) |
@perry-mitchell could you release v5.2.2 ? :) |
Released :) |
You rock!! 🎸 |
Something changed recently on the package export, and we used to be able to import it to manually do a custom request and parse the content ourselves.
I'm guessing since we're building for web, the exports is what makes our webpack process not find it?
Is there any way to mitigate this @perry-mitchell ? :)
You can see the (ugly) way around we had to do here:
https://github.com/nextcloud/server/blob/2afe26726bb48f78ef80ef1549834160121caaa4/apps/comments/src/services/GetComments.js
Cheers! ✌️
The text was updated successfully, but these errors were encountered: