I'd like to render GraphQL Playground as a React component in one of my pages but it fails due to missing file-loader
in webpack. Is there a way to fix this in docs or do I need to create new plugin with new webpack config?
Is it good idea to integrate Playground and Docusaurus at all?
Thanks for your ideas...
I just had exactly the same problem. Basically, Docusaurus with a gQL Playground Integration runs fine in local but won't compile due to errors when running yarn build as above.
In the end I found the answer is in Docusaurus, not in building a custom compiler:
import BrowserOnly from '@docusaurus/BrowserOnly';
const Explorer = () => {
const { siteConfig } = useDocusaurusContext();
return (
<Layout
title={siteConfig.title}
description="Slerp GraphQL Explorer">
<main>
<BrowserOnly fallback={<div>Loading...</div>}>
{() => {
const GraphEx = GraphExplorer
return <GraphEx />
}}
</BrowserOnly>
</main>
</Layout>
);
}
This now works and builds successfully