UNPKG

@keadex/docusaurus-plugin-mina

Version:

Docusaurus plugin to render C4 Model diagrams created with Keadex Mina.

56 lines 2 kB
"use strict"; /* eslint-disable @typescript-eslint/no-unused-vars */ Object.defineProperty(exports, "__esModule", { value: true }); const path_1 = require("path"); // eslint-disable-next-line @typescript-eslint/no-var-requires const CopyPlugin = require('copy-webpack-plugin'); function pluginMina({ siteConfig: { themeConfig }, }) { return { name: '@keadex/docusaurus-plugin-mina', configureWebpack(config, isServer) { const newConfig = {}; const minaReactPath = (0, path_1.dirname)(require.resolve('@keadex/mina-react', { paths: [process.cwd()], })); if (minaReactPath) { newConfig.plugins = [ new CopyPlugin({ patterns: [ { context: minaReactPath, from: '*.wasm', to() { return `${config.mode === 'production' ? 'assets/js/' : ''}[name][ext]`; }, }, ], }), ]; } else { throw new Error('Module @keadex/mina-react not found.'); } if (isServer) { if (!newConfig.externals) { newConfig.externals = []; } newConfig.externals.push({ canvas: 'commonjs canvas' }); newConfig.module = { rules: [ { test: /\.node$/, loader: 'node-loader', }, ], }; } newConfig.experiments = { asyncWebAssembly: true, }; return newConfig; }, }; } exports.default = pluginMina; // trigger //# sourceMappingURL=index.js.map