Registry /
devops / graphql-markdown-vitepress
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
generateDocs
✓ import { generateDocs } from 'graphql-markdown-vitepress'
✗ import generateDocs from 'graphql-markdown-vitepress'
Named export, not default. Available since v0.0.1.
createSidebar
✓ import { createSidebar } from 'graphql-markdown-vitepress'
✗ const createSidebar = require('graphql-markdown-vitepress').createSidebar
ESM-only package; require() not supported. Also available in CommonJS via bundler.
graphqlDocsPlugin
✓ import { graphqlDocsPlugin } from 'graphql-markdown-vitepress'
Vite plugin, used in VitePress config under vite.plugins.
graphqlThemeSetup
✓ import { graphqlThemeSetup } from 'graphql-markdown-vitepress/theme'
✗ import { graphqlThemeSetup } from 'graphql-markdown-vitepress'
Theme export lives in a subpath '/theme'. v0.0.1+.
Generates GraphQL docs from schema.json, creates a VitePress sidebar, and registers the theme plugin.
// .vitepress/config.ts
import { defineConfig } from "vitepress";
import {
generateDocs,
createSidebar,
graphqlDocsPlugin,
} from "graphql-markdown-vitepress";
import { resolve } from "node:path";
export default async () => {
const schemaPath = resolve(__dirname, "../schema.json");
const rootPath = resolve(__dirname, "..");
const graphqlDir = resolve(rootPath, "graphql");
await generateDocs({
schema: schemaPath,
rootPath,
baseURL: "graphql",
linkRoot: "/",
});
const sidebar = await createSidebar(graphqlDir, "graphql");
return defineConfig({
title: "GraphQL API Docs",
themeConfig: {
sidebar: { "/graphql/": sidebar },
},
vite: {
plugins: [
graphqlDocsPlugin({
schema: schemaPath,
rootPath,
baseURL: "graphql",
linkRoot: "/",
}),
],
},
});
};
// .vitepress/theme/index.ts
import DefaultTheme from "vitepress/theme";
import { graphqlThemeSetup } from "graphql-markdown-vitepress/theme";
import "graphql-markdown-vitepress/style.css";
export default {
extends: DefaultTheme,
setup() {
graphqlThemeSetup({ linkPrefix: "/graphql/" });
},
};
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module
Using require() on an ESM-only package.
fixSwitch to import syntax or use dynamic import().
Cannot find module 'graphql-markdown-vitepress/theme'
Import path missing '/theme' subpath.
fixImport from 'graphql-markdown-vitepress/theme' instead of 'graphql-markdown-vitepress'.
Property 'graphqlDocsPlugin' does not exist on type
Using TypeScript but import path is incorrect.
fixUse 'import { graphqlDocsPlugin } from "graphql-markdown-vitepress"'. Audit
Dependencies
vitepressrequiredpeer dependency for VitePress integration
viterequiredpeer dependency for build tooling
vuerequiredpeer dependency for Vue runtime