UNPKG

react-live-unplugin

Version:

Turn React components into live code blocks with ease.

31 lines (30 loc) 830 B
import process from "node:process"; import path from "pathe"; import { reactLiveUnplugin } from "../index.js"; module.exports = () => { const plugin = { name: "docusaurus-plugin-react-live", configureWebpack(config) { return { resolve: { alias: { "@docusaurus/theme-live-codeblock": path.dirname( require.resolve("@docusaurus/theme-live-codeblock/package.json", { paths: [process.cwd()] }) ) } }, plugins: [ reactLiveUnplugin.webpack({ enforce: "pre", reactLiveExportName: "LiveCodeBlock", reactLiveModulePath: "react-live-unplugin/docusaurus/LiveCodeBlock" }), ...config.plugins || [] ] }; } }; return plugin; };