-
-
Notifications
You must be signed in to change notification settings - Fork 67
error with dependencies // jsdevtools #57
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
Comments
Looks like you are missing a polyfill for the node.js Try |
Thanks so much for the response 👍 One step further. Now it ends in the browser console:
Do you have a good solution for this problem as well? |
Sorry, haven't dug that deep into You might be able to work around that error by manually setting I'd look into your vue bundler config to see if there is a way to properly include the I'd highly appreciate you report back your findings for other Vue users! |
Thanks for trying to help. Your mentioned hack with manually setting does not work either. |
Similar issue with Vue3 + Quasar2, after installing
Installing those two packages does not work. |
You’ll need to provide polyfills for these native nodejs dependencies in your bundler. See https://cli.vuejs.org/guide/browser-compatibility.html#polyfills for more details |
You’ll need to expand your webpack config and add fallbacks for the missing node dependencies. https://cli.vuejs.org/guide/webpack.html#simple-configuration Also see https://stackoverflow.com/questions/64557638/how-to-polyfill-node-core-modules-in-webpack-5 Hope this gets you on the right track! 😊 |
Well, thanks, but it actually did not help. After spending 3 hours trying to work it out, I gave up... There does not seem to be a straightforward way for Vue.js developers to use openapi-client-axios. |
Yeah, looks like Vite doesn't love "node.js" modules, so, I found one dirty solution:
export default defineConfig({
define: {
'process.browser': 'true',
},
})
<script>
Buffer = {isBuffer: () => {return false} }
</script>
import axios from 'axios';
import OpenAPIClientAxios from 'openapi-client-axios';
import { Client as PetStoreClient } from './types';
async function getClient() {
// (!) Download scheme by yourself or read from file
// because when you pass in OACA an url,
// it make some calls using fns from node native `http` and `https` libs
const definition = (await axios.get('http://127.0.0.1:3000/docs/json')).data
// Pass it into OACA
const api = new OpenAPIClientAxios({
withServer: {url:'http://127.0.0.1:3000'},
definition: definition
});
// Voila!
const client = await api.init<PetStoreClient>();
const result = await client.createDog(undefined, {name:'test'})
console.log('result', result.data)
} @anttiviljami, also I think that we can help someone with this, if will be building ESM or .min version, where all (I can't found for Vite any adequate node-core polyfill plugin too) |
Same issue, solved by adding this into
|
This issue should be fixed with |
Uh oh!
There was an error while loading. Please reload this page.
Hi all,
I've got a system up an running using Vue.js 3.0.5 and Vite as a build system.
As I need to use a Swagger API in my project I thought it might be a good deal using this openapi-client-axios.
Actually I get an error as soon as I import the client:
These lines occur the error message:
Is it possible that some of the dependencies or this entire project are not ready for Vue 3 or what am I doing wrong?
Thanks a lot.
The text was updated successfully, but these errors were encountered: