2022-09-21 19:40:49 -03:00
|
|
|
import { defineConfig } from 'vite';
|
2022-09-23 23:33:24 -03:00
|
|
|
import path from 'path';
|
2022-09-24 23:24:48 -03:00
|
|
|
import { SearchPlugin } from 'vitepress-plugin-search';
|
2022-09-23 23:33:24 -03:00
|
|
|
|
|
|
|
const virtualModuleId = 'virtual:mermaid-config';
|
|
|
|
const resolvedVirtualModuleId = '\0' + virtualModuleId;
|
2022-09-21 19:40:49 -03:00
|
|
|
|
|
|
|
export default defineConfig({
|
2022-09-23 23:33:24 -03:00
|
|
|
plugins: [
|
2022-09-24 23:24:48 -03:00
|
|
|
SearchPlugin(),
|
2022-09-23 23:33:24 -03:00
|
|
|
{
|
2022-09-24 23:24:48 -03:00
|
|
|
// TODO: will be fixed in the next vitepress release.
|
2022-09-23 23:33:24 -03:00
|
|
|
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,
|
|
|
|
})};`;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2022-09-21 19:40:49 -03:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
2022-09-23 23:33:24 -03:00
|
|
|
mermaid: path.join(__dirname, '../dist/mermaid.esm.min.mjs'), // Use this one to build
|
2022-09-21 19:40:49 -03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|