nuxt-optimized-images icon indicating copy to clipboard operation
nuxt-optimized-images copied to clipboard

SVG ?include does not work anymore

Open MattCCC opened this issue 2 years ago • 1 comments

Hello, firstly thank you for a great plugin! I really appreciate your work especially if it comes it svg loader and optimizations. It seems like svg ?include for inlining svgs doesn't work anymore in latest nuxt 2.15.7. I use follow config:

  optimizedImages: {
    optimizeImages: true,
    imagesName: ({ isDevMode }) =>
      isDevMode ? "[path][name][hash:optimized].[ext]" : "[path][name].[ext]",
    webp: {
      preset: "default",
      quality: 50,
    },
  },

This is what I get when I try to require an SVG:

ERROR in ./static/svg ?include sync ^\.\/.*\.svg$
Module not found: Error: Can't resolve 'img-loader' in '/path_cut'
 @ ./static/svg ?include sync ^\.\/.*\.svg$
 @ ./utils/svg-renderer.js
 @ ./node_modules/babel-loader/lib??ref--16-0!./node_modules/ts-loader??ref--16-1!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=ts&
 @ ./pages/index.vue?vue&type=script&lang=ts&
 @ ./pages/index.vue
 @ ./.nuxt/router.js
 @ ./.nuxt/index.js
 @ ./.nuxt/server.js
 @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./.nuxt/server.js

MattCCC avatar Jul 24 '21 16:07 MattCCC

This issue still persists. Have you found any way to avoid this error?

dfl-zeke avatar Jun 30 '22 22:06 dfl-zeke