Error: Dynamic require of "path" is not supported

发布时间 2023-06-25 14:23:26作者: 城南城南

failed to load config from D:\BaiduSyncdisk\vue3\sys-manager\vite.config.js
error when starting dev server:
Error: Dynamic require of "path" is not supported

 

 

原因在于vite中没有不支持require()

const path = require('path') 

改成
import path from 'path'