he wei
2024-04-15 c94f1afa786f297be86b01b49a641b2c0ad98b6e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import Vue from 'vue'
import SvgIcon from '@/components/SvgIcon'// svg component
// register globally
Vue.component('svg-icon', SvgIcon)
 
if (import.meta.env == undefined) {
  console.log("通过Webpack启动");
  const req = require.context('./svg', false, /\.svg$/)
  const requireAll = requireContext => requireContext.keys().map(requireContext)
  // debugger;
  requireAll(req)
  // console.log(requireAll(req), 'xxxx')
} else {
  console.log("通过Vite启动");
  // vite改造
  // const modules = [];
  // const modulesFiles = import.meta.glob('./svg/*.svg', { eager: true });
  // for (const path in modulesFiles) {
  //   // modules[path.replace(/\.\/\modules\/|\.js/g, '')] = modulesFiles[path].default
  //   // modulesFiles[path]().then((mod) => {
  //   //   console.log(path, mod)
  //   // });
  //   modules.push(modulesFiles[path])
    
  // }
  // console.log(modules);
  // export default modules;
}