mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-05 23:29:37 +02:00
docs: new Documentation
This commit is contained in:
45
docs/vite.config.ts
Normal file
45
docs/vite.config.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { defineConfig, searchForWorkspaceRoot } from 'vite';
|
||||
import path from 'path';
|
||||
import { SearchPlugin } from 'vitepress-plugin-search';
|
||||
|
||||
const virtualModuleId = 'virtual:mermaid-config';
|
||||
const resolvedVirtualModuleId = '\0' + virtualModuleId;
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
SearchPlugin(),
|
||||
{
|
||||
// TODO: will be fixed in the next vitepress release.
|
||||
name: 'fix-virtual',
|
||||
|
||||
async resolveId(id) {
|
||||
if (id === virtualModuleId) {
|
||||
return resolvedVirtualModuleId;
|
||||
}
|
||||
},
|
||||
async load(this, id) {
|
||||
if (id === resolvedVirtualModuleId) {
|
||||
return `export default ${JSON.stringify({
|
||||
securityLevel: 'loose',
|
||||
startOnLoad: false,
|
||||
})};`;
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
mermaid: path.join(__dirname, '../dist/mermaid.esm.min.mjs'), // Use this one to build
|
||||
},
|
||||
},
|
||||
server: {
|
||||
fs: {
|
||||
allow: [
|
||||
// search up for workspace root
|
||||
searchForWorkspaceRoot(process.cwd()),
|
||||
// Allow serving files from one level up to the project root
|
||||
path.join(__dirname, '..'),
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
Reference in New Issue
Block a user