-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
常见问题及解决方法 (common Q&A) #2
Comments
I'm using vite-vue2@1.0.0 including this plugin , the build result show error: TypeError: Intl.Segmenter is not a constructor. What happend to this? How should i fix this? |
This is an incompatibility with Node.js 14. Please consider upgrading your Runtime Node.js to 16+ (recommend v18+) @lish1986 |
Great. It works. I upgrade Node to v16.20.0. The build speed is faster than vite-plugin-imagemin. Thanks a lot! |
vite-plugin-compression2、vite-plugin-compression这种压缩插件,会在使用本插件转换图片格式并替换原文件之前进行压缩。 minipic({
sharpOptions: {
avif: {
lossless: true,
},
},
convert: [
{ from: 'webp', to: 'avif' },
{ from: 'png', to: 'avif' },
{ from: 'jpg', to: 'avif' },
{ from: 'jpeg', to: 'avif' },
],
}) 目前解决办法是在压缩插件中排除常见的图片格式,未来是否可以解决这个问题,或者说像webp,avif等新的web图像格式已经不需要再用gz等压缩算法等去优化体积。 |
@yangxu52 你好,gzip压缩一般只针对html,css和js,一般不用于图片文件,所以未来不会增加对这方面的支持 |
1.插件安装不成功(Install failed)
由于wall的原因,部分地区无法直接请求github上的镜像资源
在你全局或者项目的目录的.npmrc文件中增加以下内容
2.打包时报错(require() of ES Module XX from XX not supported.)
是由于本插件引用的chalk,boxen等插件都是基于es module的
在package.json中加入以下代码可以解决
或者,你可以把
vite.config.js
文件的后缀名修改为mjs
,这个方法同样奏效3.Public文件夹下的文件没有被压缩(Images in /public folder will not be compressed)
该问题已修复,把插件升级至>v1.1.0版本
4.run buid 报错Error: ENOENT: no such file or directory
该问题已修复,把插件升级至>=v1.1.3版本
The text was updated successfully, but these errors were encountered: