electron-vite-react
electron-vite-react copied to clipboard
引用ESM模块的依赖包,打包后报错
动态引入imagemin包,开发环境正常,打包后程序报错,找不到这个依赖包,如下图
在electron/main/index.ts中代码:
const imagemin = (await import('imagemin')).default
const imageminMozjpeg = (await import('imagemin-mozjpeg')).default
这个问题类似于https://github.com/electron-vite/electron-vite-react/issues/98这个问题,但现在已经版本升级了,请告诉我应该怎么解决。
感谢帮助
Reproduction repo 👉 https://github.com/dylan-7/imagemin
install imageminis error.
pls tell me your node version
将 imagemin 放到 devDependencies 中试试看,dependencies 中的依赖默认会被识别成 external 模块