emersonbottero / vitepress-plugin-mermaid

Add mermaid support for Vitepress
MIT License
95 stars 22 forks source link

fix: support users config alias.find with using regexp #58

Closed Red-Asuka closed 1 year ago

Red-Asuka commented 1 year ago

The find property of alias may be a RegExp, in this case, it cannot be converted to an object and will display an error: Type 'RegExp' cannot be used as an index type.

For example, when we need to replace a component of the default theme:

alias: [
  {
    find: /^.*\/VPHero\.vue$/,
    replacement: fileURLToPath(
      new URL('../theme/components/Hero.vue', import.meta.url),
    ),
  },
]