Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@react-pdf/png-js redefines Buffer? #2062

Closed
cefn opened this issue Oct 24, 2022 · 1 comment
Closed

@react-pdf/png-js redefines Buffer? #2062

cefn opened this issue Oct 24, 2022 · 1 comment

Comments

@cefn
Copy link

cefn commented Oct 24, 2022

Attempting to migrate a project to pnpm and vite which successfully used @react-pdf/renderer a year ago. You can see the stable version using npm and nextjs at https://cefn.com/cv

I had to upgrade to 3.0.0 owing to issues in version 2 like this one and this one

However, now an attempt to run tsc && vite build leads to the following fatal error - both lines are source code which I believe comes through dependencies from @react-pdf/[email protected]

✘ [ERROR] The symbol "Buffer" has already been declared
    node_modules/.pnpm/@[email protected]/node_modules/@react-pdf/png-js/lib/png-js.browser.es.js:6952:4:
      6952 │ var Buffer = safeBuffer.exports.Buffer;
           ╵     ~~~~~~
  The symbol "Buffer" was originally declared here:
    node_modules/.pnpm/@[email protected]/node_modules/@react-pdf/png-js/lib/png-js.browser.es.js:2:16:
      2 │        import { Buffer } from 'buffer';
        ╵                 ~~~~~~

/home/cefn/Documents/github/cvvite/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1566
  let error = new Error(`${text}${summary}`);
              ^
Error: Build failed with 1 error:
@cefn
Copy link
Author

cefn commented Oct 25, 2022

This may have been an artefact of the module patching attempted in https://www.npmjs.com/package/vite-plugin-shim-react-pdf and which was no longer needed, but had affected my locally-versioned module.

@cefn cefn closed this as completed Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant