antd index.js文件中源码正则匹配的问题

新手上路,请多包涵

index.js文件中req.keys().forEach()中,mod如果是./组件名称/style/index.tsx,那下面这个正则匹配的结果是null,但是看代码它应该是想匹配组件名称然后导出吧,这个是正则写法的问题吗?

  const match = mod.match(/^\.\/([^_][\w-]+)\/index\.tsx?$/);
  console.log(match)  //null
if (match && match[1]) {
    if (match[1] === 'message' || match[1] === 'notification') {
      // message & notification should not be capitalized
      exports[match[1]] = v;
    } else {
      exports[camelCase(match[1])] = v;
    }
  }
阅读 822
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题