Skip to content

Using with vanilla js ESM causes TypeError on console #89

Description

@anajavi

I am getting an TypeError to console from react-pdf-html when running it.

    console.error
      Error parsing style attribute "width:100%;height:100%" for tag: SVG TypeError: cssParse is not a function
          at convertElementStyle (/proj/node_modules/react-pdf-html/src/parse.ts:108:20)
          at convertNode (/proj/node_modules/react-pdf-html/src/parse.ts:146:13)
          at Array.map (<anonymous>)
          at convertNode (/proj/node_modules/react-pdf-html/src/parse.ts:133:35)
          at parseHtml (/proj/node_modules/react-pdf-html/src/parse.ts:171:18)
          at renderHtml (/proj/node_modules/react-pdf-html/src/render.tsx:369:18)
          at Html (/proj/node_modules/react-pdf-html/src/Html.tsx:15:13)

This is probably caused by:

import * as cssTree from 'css-tree';
const { generate, parse: cssParse } = cssTree;

Everything works alright if I change it to the following:

import cssTree from 'css-tree';
const { generate, parse: cssParse } = cssTree;

related: #83

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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