使用vite打包后出现 exports is not defined

1,492 阅读1分钟
  1. 当你使用electron出现这个问题时可以查看官方的解决办法具体方法是 `

import polyfillExports from 'vite-plugin-electron/polyfill-exports'

export default { plugins: [ // ...other plugins polyfillExports(), ], } ` 2. 未使用electron 出现以上问题大概率是因为 路由懒加载导致以上的问题 (1)将懒加载替换为普通加载。 (2)我是使用pnpm启动会出现这个问题 删除nodemodules/ 改为yarn 启动以上问题解决