pdfme / pdfme

A TypeScript based PDF generator library, made with React.
https://pdfme.com
MIT License
2.19k stars 194 forks source link

Doesn't load after build #166

Closed riicardojs closed 11 months ago

riicardojs commented 1 year ago

Describe the bug

When running the project on localhost I have no problems running the template-design, but when generating the project build it does not load, showing an error

To Reproduce

Expected behavior

Project run smoothly after build

Your Environment

- pdfme package(@pdfme/generator or @pdfme/ui):
- pdfme version: v1.1.10
- Operating system: WSL2 (Ubuntu)
- Node.js version: v16 and v18

Your Error Log

react_devtools_backend_compact.js:2367 TypeError: "a" is read-only
    at e.exports (readOnlyError.js:2:9)
    at hooks.ts:26:40
    at new Promise (<anonymous>)
    at hooks.ts:36:44
    at hooks.ts:43:5
    at Lo (react-dom.production.min.js:262:359)
    at t.unstable_runWithPriority (scheduler.production.min.js:18:343)
    at zr (react-dom.production.min.js:122:325)
    at So (react-dom.production.min.js:261:308)
    at react-dom.production.min.js:261:215

Additional context

image image

rnxj commented 1 year ago

Hey man!!! Were able to figure out a solution for this issue. I'm struggling with the same but in nextjs 😩😩

hand-dot commented 1 year ago

ref: https://github.com/pdfme/pdfme/issues/172

hand-dot commented 1 year ago

ref: https://github.com/pdfme/pdfme/discussions/168

rnxj commented 1 year ago

The error that I encounter is

image

I was trying to figure out where exactly the variable was declared and what was the problem with it. But still wasn't able to find anything that would cause an issue. Please have a look man 😩

hand-dot commented 1 year ago

I'm sorry for causing you inconvenience, I will check it later. I will make sure to include this fix in the next release.

hand-dot commented 1 year ago

I was able to reproduce this issue on my computer using https://github.com/pdfme/pdfme-playground. There are no problems in the development build, but this error occurs in the production build.

The changes in the release below might be related. https://github.com/pdfme/pdfme/releases/tag/1.1.10

I will continue to investigate.

riicardojs commented 1 year ago

Thank you for your help, I performed the correction test of ref: #172 but I was not successful with the correction of the production build.

I made a fork of your project and went up to my npm to carry out the tests, installing my version I was successful in 1 project, but in the other project I still have the same problem, I don't know if it is related to a 3rd dependency that is generating conflict, I will wait for your tests and a possible solution, thank you.

Whatever you need help, I'm available to help solve this problem!

hand-dot commented 1 year ago

@riicardojs

Thank you. To be honest, I don't know what the problem is right now... When I find the time, I plan to try and see at what point the build starts to fail.

If you figure out a case where it works, please share it here.

hand-dot commented 12 months ago

When I built the current master branch code and tried it in two patterns, I got different results for each.

In the project based on the following CRA, it fails as shown in the following image https://github.com/pdfme/pdfme-playground

CleanShot 2023-06-03 at 16 35 48@2x

However, in the project based on the following Docusaurus, it is displayed correctly as shown in the following image https://github.com/pdfme/pdfme/tree/main/website

CleanShot 2023-06-03 at 16 36 00@2x

I have another project based on Nextjs, so I'll try that next.

hand-dot commented 12 months ago

I also tried it with a Next.js based project, but no error occurred.

CleanShot 2023-06-03 at 16 51 42@2x

@riicardojs @ReuelNixon Can you provide me with the minimal reproduction code for the projects that you failed other than pdfme-playground?

hand-dot commented 12 months ago

I have made the correction. It will be included in the next release.

hand-dot commented 12 months ago

@riicardojs @ReuelNixon Fixed this in version 1.2.0. I believe the problem has been resolved by updating pdfme to the latest version. Could you please check?

rnxj commented 11 months ago

Hey man, Sorry for not reaching out at the time. Actually I updated my app to use the newer version of pdfme but still I was getting the error. For further reference here is my repo to replicate the issue https://github.com/ReuelNixon/certificate-generator.

image