Skip to content

PDF.js + Webpack runs into type error: Value is non of these types String, Path #1126

@Cybourgeoisie

Description

@Cybourgeoisie

An earlier issue, #994, has been resolved as of 0.1.72. A similar issue, since that release, for all combinations of PDF.js and @napi-rs/canvas, has appeared with a similar type error:

Error: Value is non of these types `String`, `Path`, 
    at CanvasGraphics.consumePath (/Users/cybourgeoisie/Documents/Cybourgeoisie/webpack-pdfjs-napirscanvas-test/dist/626.main.js:16611:15)
    at CanvasGraphics.endPath (/Users/cybourgeoisie/Documents/Cybourgeoisie/webpack-pdfjs-napirscanvas-test/dist/626.main.js:15634:10)
    at CanvasGraphics.constructPath (/Users/cybourgeoisie/Documents/Cybourgeoisie/webpack-pdfjs-napirscanvas-test/dist/626.main.js:15543:13)
    at CanvasGraphics.executeOperatorList (/Users/cybourgeoisie/Documents/Cybourgeoisie/webpack-pdfjs-napirscanvas-test/dist/626.main.js:15104:23)
    at InternalRenderTask._next (/Users/cybourgeoisie/Documents/Cybourgeoisie/webpack-pdfjs-napirscanvas-test/dist/626.main.js:20642:37)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'InvalidArg'
}

Similar to the previous issue, this issue does not show up when running in dev, but it does show up in the built code with webpack.

I have updated the test repo with the current versions for reproduction: https://github.com/Cybourgeoisie/webpack-pdfjs-napirscanvas-test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions