fix: fix wrong regex that removes extra letters from swizzled component names (#5268)

This commit is contained in:
Joshua Chen 2021-08-02 17:44:45 +08:00 committed by GitHub
parent 8a198ef20a
commit bd46de18f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,8 +50,8 @@ export function getPluginNames(plugins: PluginConfig[]): string[] {
const formatComponentName = (componentName: string): string => const formatComponentName = (componentName: string): string =>
componentName componentName
.replace(/(\/|\\)index.(js|tsx|ts|jsx)/, '') .replace(/(\/|\\)index\.(js|tsx|ts|jsx)/, '')
.replace(/.(js|tsx|ts|jsx)/, ''); .replace(/\.(js|tsx|ts|jsx)/, '');
function readComponent(themePath: string) { function readComponent(themePath: string) {
function walk(dir: string): Array<string> { function walk(dir: string): Array<string> {