Skip to content

Importing svg's using svgr/webpack no longer works in the latest canary release when using ppr (error: Cannot read properties of undefined (reading 'stack')) #66137

@sceppi

Description

@sceppi

Link to the code that reproduces this issue

https://github.com/sceppi/svgbug

To Reproduce

See example github code to reproduce.

  1. Create a new nextjs project enabling the experimental ppr:true
  2. import an svg into a page (make sure to have @svgr/webpack installed)
  3. run the project in development mode and going to the page results in error:
    TypeError: Cannot read properties of undefined (reading 'stack')
    at stringify ()
    at AsyncLocalStorage.run (node:async_hooks:346:14)
    digest: "2015626987"

Setting ppr to false resolves the error, so it is related to ppr
The issue only occurs when importing an svg. Just placing an svg directly in the code works fine

Current vs. Expected behavior

Importing an svg like this worked find in next 14.3.0-canary.70 (with ppr enabled) but no longer works in next 14.3.0-canary.79

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Enterprise
  Available memory (MB): 7789
  Available CPU cores: 8
Binaries:
  Node: 20.11.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.3.0-canary.79 // Latest available version is detected (14.3.0-canary.79).
  eslint-config-next: 14.3.0-canary.79
  react: 19.0.0-rc-f994737d14-20240522
  react-dom: 19.0.0-rc-f994737d14-20240522
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure, Webpack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

Issue only occurs in development mode. It does not occur in Next 14.3.0-canary.70 but it occurs in 14.3.0-canary.79 (maybe also some earlier versions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    WebpackRelated to Webpack with Next.js.bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions