const componentFiles = require.context("./components", true, /\.vue$/);

// key是相对路径名
const components = componentFiles.keys().reduce((tmp, key) => {
  const name = key.replace(/^\.\/(.*)\.\w+$/, "$1");
  // eslint-disable-next-line no-param-reassign
  tmp[name] = componentFiles(key).default;
  return tmp;
}, {});

export default {
  components,
};
