-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
Uncaught TypeError: Cannot read properties of undefined (reading 'alloc') when using react with Vite #1009
Comments
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 |
This doesn't solve the issue for me |
With the standalone component is it not working for me I'm getting
but the util.debuglog is native function of Node.js |
@MateuszPe 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.
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
:App.tsx
component.npm run dev
and try to render react component with asyncapi.Troubleshooting
v1.4.x
andv2.0.0
The text was updated successfully, but these errors were encountered: