1. 问题现象 vite项目中出现的错误Error: Dynamic require of “path” is not supported 2. 为什么会这样? 因为vite中没有不支持require() 3. 如何解决 将require()改成import xxx const path = require('path') // 之前:导致报错 import path from 'path' // 现在:使用import导入解决错误