Open MateuszPe opened 5 months ago
Not much experience with vite here. We're you able to identify where is the issue coming from?
you should use standalone component to fix this. We fixed in that approach only
you should run "npm install buffer" to resolve this issue
you should run "npm install buffer" to resolve this issue
This doesn't solve the issue for me
you should use standalone component to fix this. We fixed in that approach only
With the standalone component is it not working for me
I'm getting
util.debuglog is not a function
but the util.debuglog is native function of Node.js and I can use that in other file, same project
@MateuszPe I think the issue here is that you are importing it from
import AsyncApiComponent from "@asyncapi/react-component"
instead import it from
import AsyncApiComponent from "@asyncapi/react-component/browser";
also dont forget to import the css
import "@asyncapi/react-component/styles/default.min.css";
source:- the setup in this is similar to what nextjs has. just the dynamic import part is specific to nextjs.
My App.tsx in vite for reference.
import "@asyncapi/react-component/styles/default.min.css";
import AsyncApiComponent from "@asyncapi/react-component/browser";
export const AsyncApi = () => {
return (
<>
<AsyncApiComponent schema={schema} />
</>
);
};
const schema = `
asyncapi: '2.0.0'
info:
title: Example
version: '0.1.0'
channels:
example-channel:
subscribe:
message:
payload:
type: object
properties:
exampleField:
type: string
exampleNumber:
type: number
exampleDate:
type: string
format: date-time
`;
function App() {
return <AsyncApi />;
}
export default App;
Edit: i didnt notice it. but @rk3592 mentioned the same thing above.
you should use standalone component to fix this. We fixed in that approach only
the standalone component is found in the import path i have specified above
Description
I am trying to use React component for rendering documentation. I cannot use it due to the problem with missing modules. I created new application with create react app (I am aware that it is deprecated)
Then I installed asyncapi-react:
I tried to use
v20.13.1
orv18.20.3
package.json content:
Expected result
Application renders provided anyncapi definition.
Actual result
Steps to reproduce
npm create vite@latest asyncApiProject -- --template react-ts
npm install --save @asyncapi/react-component
AsyncApi.tsx
:export const AsyncApi = () => { return <>
}
const schema =
asyncapi: '2.0.0' info: title: Example version: '0.1.0' channels: example-channel: subscribe: message: payload: type: object properties: exampleField: type: string exampleNumber: type: number exampleDate: type: string format: date-time
;