Closed Red-Asuka closed 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.
find
alias
RegExp
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), ), }, ]
The
find
property ofalias
may be aRegExp
, 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: