// 自动导入 ./xxx module/index.js
// https://webpack.js.org/guides/dependency-management/#require-context
const modules = require.context(
  // 当前目录下搜索
  '.',
  // 包含子目录
  true,
  // 文件名的规则
  /^\.\/[a-z-]+\/index-normalize-route.js$/
)
modules.keys().forEach((fileName) => {
  modules(fileName)
})

const modulesProduct = require.context(
  '../src_product',
  true,
  /^\.\/[a-z-]+\/[a-z-]+\/index-normalize-route.js$/
)
modulesProduct.keys().forEach((fileName) => {
  modulesProduct(fileName)
})

const modulesCustom = require.context(
  '../src_custom',
  true,
  /^\.\/[0-9a-z-]+\/index-normalize-route.js$/
)
modulesCustom.keys().forEach((fileName) => {
  modulesCustom(fileName)
})
