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

Rollup failed to resolve import "wretch/middlewares" #160

Closed
sh-ravan opened this issue Jan 7, 2023 · 4 comments
Closed

Rollup failed to resolve import "wretch/middlewares" #160

sh-ravan opened this issue Jan 7, 2023 · 4 comments
Labels

Comments

@sh-ravan
Copy link

sh-ravan commented Jan 7, 2023

I can't get the built-in middleware to work in my Vite project. I have "wretch": "^2.3.0" installed but when I try to build it, it throws an error that says, Rollup failed to resolve import "wretch/middlewares". Looks like it's something to do with the bundler as it can be reproduced in both these places:

https://stackblitz.com/edit/vitejs-vite-cbj21z
https://codesandbox.io/p/sandbox/competent-elbakyan-129ojg

@elbywan elbywan added the bug label Jan 7, 2023
@elbywan
Copy link
Owner

elbywan commented Jan 7, 2023

Hey @sh-ravan,

Thanks for reporting the issue 🙏 , I managed to reproduce and this is related to the subpath exports.

I'm looking into it and will publish a fix asap but in the meatime you should be able to import from the nested files instead of the index:

import { retry } from "wretch/middlewares/retry"

@sh-ravan
Copy link
Author

sh-ravan commented Jan 7, 2023

Ah, thanks for the quick resolution mate!

Also, heckin cool library. Good riddance axios :P

elbywan added a commit that referenced this issue Jan 7, 2023
should solve #160

Importing from `wretch/middlewares` and `wretch/addons` should work properly now.
@elbywan
Copy link
Owner

elbywan commented Jan 7, 2023

Also, heckin cool library. Good riddance axios :P

Haha thanks! 😄

I just released [email protected] which should solve the issue, importing from wretch/middlewares and wretch/addons should be working now 🤞.

@sh-ravan
Copy link
Author

sh-ravan commented Jan 7, 2023

I just tested it, the new version works perfectly! ⚡

@sh-ravan sh-ravan closed this as completed Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants