sz861128 2022-07-01 12:56 采纳率: 25%
浏览 134

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 matlab runtime 如何收费
    • ¥20 用C语言绘制cs1.6方框透视 出现了点问题 绘制不上去 矩阵数据 和敌人坐标都是正确的
    • ¥15 Tpad api账户 api口令
    • ¥30 ppt进度条制作,vba语言
    • ¥15 生信simpleaffy包下载
    • ¥15 请教一下simulink中S函数相关问题
    • ¥15 在二层网络中,掩码存在包含关系即可通信
    • ¥15 端口转发器解析失败不知道电脑设置了啥
    • ¥15 Latex算法流程图行号自定义
    • ¥15 关于#python#的问题:我在自己的电脑上运行起来总是报错,希望能给我一个详细的教程,(开发工具-github)