-
-
Notifications
You must be signed in to change notification settings - Fork 125
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
Can't import in a Docusaurus project - error can't resolve 'http'
#734
Comments
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request. |
Yup, it looks like Docusaurus is a pure client-side app. AsyncAPI React component is not purely client-side but we're publishing a client-side version of it that I guess that's what you should be using. Can you try using the |
@AchrafAmil please check with latest release candidate -> v1.0.0-next.48 @fmvilas |
Just tried v1.0.0-next.48 and I still get the same error. |
It is not because it depends on the AsyncAPI parser that access the Node.js fs package. Last time I checked, we were using browserify to make it browser-compatible. Not sure it's still the same. |
@AchrafAmil the reason is https://github.com/APIDevTools/json-schema-ref-parser/blob/v9.0.6/lib/resolvers/http.js#L3 and after short investigation I think it is because of the node version that you are using 🤔 so Try to use Node 14, maybe that helps |
@derberg I can't force Node 14 as it's not supported by facebook/docusaurus
|
and if I "ignore engines" I get this (very likely some new syntax that node 14 can't get)
|
oh not cool 😞 you have 2 options:
|
Not yet but my idea is to give it a bump around September. |
@AchrafAmil another workaround, until a new version of the
You may also load the standalone script in the scripts section of the docusaurus.config.js, if so, remeber to also manually load the stylesheet. |
This issue has been automatically marked as stale because it has not had recent activity 😴 It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation. There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model. Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here. Thank you for your patience ❤️ |
still an issue |
This issue has been automatically marked as stale because it has not had recent activity 😴 It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation. There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model. Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here. Thank you for your patience ❤️ |
Still an issue. Even have the same problem in other client-side only projects like vite. import { useEffect, useRef } from "react";
import { AsyncApiProps } from "@asyncapi/react-component";
import "@asyncapi/react-component/styles/default.min.css";
// This wrapper is needed to load the standalone version of asyncapi
// since the original version relies on server-side rendering
export function AsyncApi({ schema, config }: AsyncApiProps) {
const ref = useRef<HTMLDivElement | null>(null);
useEffect(() => {
const AsyncApiStandalone = require("@asyncapi/react-component/browser/standalone");
AsyncApiStandalone.render(
{
schema,
config,
},
ref.current
);
}, [schema, config]);
return (
<div ref={ref} id="asyncapi">
Loading...
</div>
);
} |
FWIW, I went for the (pretty savage but quick) workaround of simply putting the fat single-file html+css+javascript in a React component. It gives the following results: https://docs.nabla.com/server/copilot-listen-ws |
This issue has been automatically marked as stale because it has not had recent activity 😴 It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation. There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model. Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here. Thank you for your patience ❤️ |
Description
My goal is to deploy two docs (OpenAPI & AsyncAPI) together in the same place.
I generate a Docusaurus website using steps docusaurus-openapi. The result is at the "Initial commit" of the reproducible minimal example.
I add a custom react page as described in their doc and import a random react component in it ('awesome-react-button'), and it works:
Expected result
Import to work and not break everything.
Actual result
Compilation errors
Full errors snippet
Steps to reproduce
Checkout before/after this commit in the reproducible: AchrafAmil/DocusaurusAsyncAPI@7370bc3
Troubleshooting
Web dev is really not my comfort zone so I might be doing/saying something wrong, but it seems like the AsyncAPI React component is using a node.js dependency that shouldn't be there (?).
The text was updated successfully, but these errors were encountered: