「已注销」 2022-07-01 12:56 采纳率: 25%
浏览 145

imagemin-webp-webpack-plugin 依赖报错 The system cannot find the path specified.

最近在研究如何在 vue 中使用 webp 格式图片,于是找到了 imagemin-webp-webpack-plugin 依赖

按照说明配置 vue.config.js 如下:

const { defineConfig } = require('@vue/cli-service')
const ImageminWebpWebpackPlugin = require('imagemin-webp-webpack-plugin')
module.exports = defineConfig({
  transpileDependencies: true,
  // 基本路径
  publicPath: '/',
  configureWebpack: {
    // 插件
    plugins: [new ImageminWebpWebpackPlugin({
      config: [{
        test: /\.(jpe?g|png|gif)/,
        options: {
          quality: 75
        }
      }],
      overrideExtension: false,
      detailedLogs: true,
      silent: true,
      strict: true
    })]
  }
})

后运行/打包均无法顺利生成 .webp 格式文件,报错信息如下:

 

 目前个人怀疑是执行顺序问题,但由于技术欠佳还未查到解决办法

请问是否有同学遇到此类问题,又是如何解决的呢?

补充一下,我的版本信息如下:

webpack 8.13.1
----------------------
cnpm@8.2.0 (C:\Users\Dell\AppData\Roaming\npm\node_modules\cnpm\lib\parse_argv.js)
npm@8.13.2 (C:\Users\Dell\AppData\Roaming\npm\node_modules\cnpm\node_modules\npm\index.js)
node@16.15.1 (D:\Program Files\nodejs\node.exe)
npminstall@6.4.0 (C:\Users\Dell\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\index.js)
prefix=C:\Users\Dell\AppData\Roaming\npm
win32 x64 10.0.19044
registry=https://registry.npmmirror.com
  • 写回答

1条回答 默认 最新

  • 崽崽的谷雨 2022-07-01 13:24
    关注

    图片路径问题吧 。

    评论

报告相同问题?

问题事件

  • 修改了问题 7月1日
  • 修改了问题 7月1日
  • 创建了问题 7月1日

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵