question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Latest NextJS (10.1.4-canary.6) with Webpack 5 enabled fails: error - ./some-icon.svg?sprite TypeError: Cannot read property 'version' of undefined

See original GitHub issue

What?

Hi, I’m trying to update my NextJS project from 10.0.5-canary.3 to 10.1.4-canary.6. And I’m enabling Webpack 5.

The feature that I’m using from next-optimized-images is the SVG sprite generation.

After remove node_modules and start Next project again in dev mode I see this error on the console:

error - ./components/Footer/logo-footer.svg?sprite
TypeError: Cannot read property 'version' of undefined
event - build page: /next/dist/pages/_error

Did anyone found this problem?

This is my next.cofig.js

const withPlugins = require('next-compose-plugins')
const optimizedImages = require('next-optimized-images')
const nextConfig = {
  distDir: 'next-server',
  future: { webpack5: true },
}

module.exports = withPlugins(
  [
    [
      optimizedImages,
      {
        imagesFolder: 'images',
        imagesName: '[name]-[hash].[ext]',
        handleImages: ['svg', 'png'],
        svgo: {}
      }
    ]
  ],
  nextConfig
)

Thanks

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
danielberndtcommented, Apr 22, 2021

It’s an issue in the underlying repo. A PR is already prepared: https://github.com/JetBrains/svg-sprite-loader/pull/452.

You can use patch-package to apply this fix locally in case the PR isn’t merged yet.

0reactions
andresgutgoncommented, May 6, 2021

Let me check and I’ll close it : )

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bountysource
Latest NextJS (10.1.4-canary.6) with Webpack 5 enabled fails: error - ./some-icon.svg?sprite TypeError: Cannot read property 'version' of undefined.
Read more >
Firmware 1.12.0 version to CUAV X7 - PX4/PX4-Autopilot
Issue Title Created Date Comment Count Updated Date fast‑export does not follow last stored state 0 2021‑02‑18 2022‑09‑26 Document `‑f` Argument to mega‑linter‑runner 0 2022‑09‑21...
Read more >
Cyrilwanner Next-Optimized-Images Statistics & Issues - Codesti
Latest NextJS (10.1.4-canary.6) with Webpack 5 enabled fails: error - ./some-icon.svg?sprite TypeError: Cannot read property 'version' of undefined, open, 5 ...
Read more >
Cyril Wanner next-optimized-images Issues - Giters
Latest NextJS (10.1.4-canary.6) with Webpack 5 enabled fails: error - ./some-icon.svg?sprite TypeError: Cannot read property 'version' of undefined.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found