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

ofetch.create is not a function #198

Closed
daguanren21 opened this issue Dec 14, 2022 · 3 comments · Fixed by #211
Closed

ofetch.create is not a function #198

daguanren21 opened this issue Dec 14, 2022 · 3 comments · Fixed by #211
Labels
bug Something isn't working

Comments

@daguanren21
Copy link

Environment

node version is 14.18.0,ofetch version is 1.0.0

Reproduction

image

Describe the bug

I want to use ofecth.create function to create baseUrl,but appear ofetch.create is not a function . plz

Additional context

No response

Logs

No response

@Shyam-Chen
Copy link

Shyam-Chen commented Dec 16, 2022

import { ofetch } from 'ofetch';

const request = ofetch.create({ baseURL: '/api' });

console.log(request);
// [Function: $fetch2] {
//   raw: [AsyncFunction: $fetchRaw2],
//   native: [Function (anonymous)],
//   create: [Function (anonymous)]
// }

console.log(process.version);
// v14.19.3

@nozomuikuta
Copy link
Member

@daguanren21

Would you provide a minimal reproduction instead of a screenshot and reopen this issue later?

@pi0 pi0 reopened this Jan 12, 2023
@markbrouch
Copy link

This seems to be an issue with cjs exports.

cjs (create is not a function): https://stackblitz.com/edit/node-9rgwsr?file=index.js

module (create runs correctly): https://stackblitz.com/edit/node-wqz68m?file=index.js

@nozomuikuta nozomuikuta added bug Something isn't working and removed needs reproduction labels Jan 26, 2023
@pi0 pi0 closed this as completed in #211 Feb 16, 2023
Trugamr added a commit to Trugamr/sony-tv-api that referenced this issue Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants