| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
For those who use webpack and want a quick fix, while this isn't correctly addressed, you can create an alias and point to the correct file: In the webpack.config.js include: resolve: {
alias: {
'unfetch': path.resolve(__dirname, 'node_modules/unfetch/dist/unfetch.mjs'),
},
}, |
Sorry, something went wrong.
Co-authored-by: Ryan Christian <33403762+rschristian@users.noreply.github.com>
|
Looks correct to me! |
Sorry, something went wrong.
|
@rschristian @developit pinging in case you have forgotten to approve |
Sorry, something went wrong.
|
Sorry, not a maintainer, my approval does nothing. Just a drive-by suggestion as I ran into this and was seeing if anyone had submitted a fix yet. |
Sorry, something went wrong.
Workes fine. Thanks |
Sorry, something went wrong.
This is pending a fix to a how unfetch 5 exports its files, e.g. developit/unfetch#164
This is pending a fix to a how unfetch 5 exports its files, e.g. developit/unfetch#164
|
Can this be merged? I really need this change since in cannot start storybook in my project, Thanks for fixing this! 🥳 |
Sorry, something went wrong.
But its showing that your review is pending..
|
Sorry, something went wrong.
|
Doesn't matter -- GitHub's UI is a bit weird there for sure, but the approval of non-maintainers does nothing. You'd see a "collaborator" badge (I think) next to my name if I was able to approve and merge. |
Sorry, something went wrong.
Sorry, something went wrong.
|
This would be really nice to have merged since it currently is unusable in vite without a manual override. For anyone else using vite, adding a resolve alias solved this for now: defineConfig({
resolve: {
alias: {
unfetch: path.resolve(__dirname, "node_modules/unfetch/dist/unfetch.mjs"),
}
}
})
|
Sorry, something went wrong.
=> Failed to build the preview And if I'm importing import path from 'path'; I'm still getting |
Sorry, something went wrong.
Without this patch people were experiencing problems when bundling the SDK. See issue ToucanProtocol#95 ToucanProtocol#95 The problem is that `isomorphic-unfetch` 4.0.2 upgraded to `unfetch` 5.0.0 which currently has an issue with their module exports leading to an error when bundling the lib itself or any other lib that depends on `unfetch`. See this PR for more information: developit/unfetch#164 Once this PR is merged we can go back to the latest `isomorphic-unfetch` version.
Without this patch people were experiencing problems when bundling the SDK. See issue ToucanProtocol#95 ToucanProtocol#95 The problem is that `isomorphic-unfetch` 4.0.2 upgraded to `unfetch` 5.0.0 which currently has an issue with their module exports leading to an error when bundling the lib itself or any other lib that depends on `unfetch`. See this PR for more information: developit/unfetch#164 Once the PR above is merged we can go back to the latest `isomorphic-unfetch` version.
|
Can someone merge this, please? |
Sorry, something went wrong.
An issue with `unfetch@5`, depended on by `isomorphic-unfetch@4.0.2`, breaks bundling with tools such as `esbuild` and `webpack`: developit/unfetch#164
|
Any chance this can get merged and published? Lots of bundler workarounds required right now 😅 |
Sorry, something went wrong.
|
@developit is this possible to merge? Not sure on the status on the library, but this one would be a really helpful fix. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
First of all, thanks for this library! We have been using it for quite a long time, and it works like a charm.
Description
It seems that there are invalid values exported in the package.json https://github.com/developit/unfetch/blob/main/package.json#L18
It causes issue while using unfetch as a module, for instance, we use webpack and once upgraded to 5.0.0 it started to break the build with the given (not so clear, to say the least) error:
ERROR in ./src/index.js 1:0-30 Module not found: Error: Can't resolve 'unfetch' in '/Users/user/dev/unfetch-issue-demo/src' resolve 'unfetch' in '/Users/user/dev/unfetch-issue-demo/src' Parsed request is a module using description file: /Users/user/dev/unfetch-issue-demo/package.json (relative path: ./src) Field 'browser' doesn't contain a valid alias configuration resolve as module /Users/user/dev/unfetch-issue-demo/src/node_modules doesn't exist or is not a directory looking for modules in /Users/user/dev/unfetch-issue-demo/node_modules single file module using description file: /Users/user/dev/unfetch-issue-demo/package.json (relative path: ./node_modules/unfetch) no extension Field 'browser' doesn't contain a valid alias configuration /Users/user/dev/unfetch-issue-demo/node_modules/unfetch is not a file .tsx Field 'browser' doesn't contain a valid alias configuration /Users/user/dev/unfetch-issue-demo/node_modules/unfetch.tsx doesn't exist .ts Field 'browser' doesn't contain a valid alias configuration /Users/user/dev/unfetch-issue-demo/node_modules/unfetch.ts doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /Users/user/dev/unfetch-issue-demo/node_modules/unfetch.js doesn't exist .jsx Field 'browser' doesn't contain a valid alias configuration /Users/user/dev/unfetch-issue-demo/node_modules/unfetch.jsx doesn't exist existing directory /Users/user/dev/unfetch-issue-demo/node_modules/unfetch ...Demo
Here you can see an example of this issue:
https://github.com/cristianoliveira/unfetch-issue-demo
Solution
After pointing to src/index.mjs it started to compile again and it is working as expected. 😄
Let me know if this is the right solution.
Relates to
#163
#162