Comments (14)
I had this problem too, building v3.0.6 with the previously used version of pdfjs-dist works (2.0.203). I'm guessing there is some problem with that.
from react-pdf-js.
Ok no - it's a peer dependencies.
Make sure you have the correct pdfjs-dist version in your package.json:
"pdfjs-dist": "2.0.303", "react-pdf-js": "3.0.6",
from react-pdf-js.
@Driptap issue still persist
from react-pdf-js.
Try manually deleting the react-pdf-js & pdfjs-dist folders from node modules, then installing the correct versions from the command line:
npm i -S [email protected]
npm i -S [email protected]
I left the caret in by mistake on the previous comment, it still grabs latest version of pdfjs-dist
from react-pdf-js.
I'd remove the pdfjs-dist from your package.config and let this package handle it.
from react-pdf-js.
@Driptap Thanks.
from react-pdf-js.
What is the solution for the problem now? When letting react-pdf-js handle it, thats exactly when i'm getting the error and i can't ged rid of it.
from react-pdf-js.
Letting the package handle it seems to results in a newer version of pdfjs-dist (2.0.328
) to be installed - this seems to be causing the Module Not Found error.
@sebastianmenge For now you should be able to install the correct version by adding "pdfjs-dist": "2.0.303"
to your package.json, removing pdfjs-dist from node_modules and reinstalling.
@mikecousins maybe it is worth specifying the exact version of pdfjs-dist in react-pdf-js's package.json?
from react-pdf-js.
thanks @Driptap for clearing it up. i was just confused by the answer and thought the way to go would be not putting the pdfjs-dist in the package. working now.
from react-pdf-js.
@mikecousins When there will be release with corrected bugs?
from react-pdf-js.
Currently, in my project I had to add
"pdfjs-dist": "2.0.139",
"react-pdf-js": "3.0.0",
to this specific version of pdfjs-dist. It appears that the newer version of pdfjs-dist is missing pdf.combined JS file, which even the master branch of this repo depends on still.
Which, is probably a good thing, because that file (old version) injects an override of Object.defineProperty which does not work as expected: https://raw.githubusercontent.com/mozilla/pdfjs-dist/846bbae9bcb9ce06ca3d04da9e99beecb9900e82/build/pdf.combined.js
Object.defineProperty = function objectDefineProperty(obj, name, def) {
delete obj[name];
if ('get' in def) {
obj.__defineGetter__(name, def['get']);
}
if ('set' in def) {
obj.__defineSetter__(name, def['set']);
}
if ('value' in def) {
obj.__defineSetter__(name, function objectDefinePropertySetter(value) {
this.__defineGetter__(name, function objectDefinePropertyGetter() {
return value;
});
return value;
});
obj[name] = def.value;
}
};
This library should use the non "combined" version of this file, no?
from react-pdf-js.
@Driptap I can confirm that the Object.definePropert tomfoolery is removed in this version of pdfjs-dist (https://raw.githubusercontent.com/mozilla/pdfjs-dist/d90724150fdff57ba76c25e2f3167d12105ba2a1/build/pdf.combined.js, find "defineProperty =" missing). However, if I have dependencies
"dependencies": {
"pdfjs-dist": "2.0.303",
"react-pdf-js": "3.0.6"
},
I still end up with the new version of pdfjs-dist, which is incompatible, in the local node_modules/ of react-pdf-js
➜ myproj git:(master) ✗ npm list pdfjs-dist
[email protected] /Users/rosenbek/myproj
├── [email protected]
└─┬ [email protected]
└── [email protected]
and version 2.0.332 is missing pdf.combined.js.
The PR above should fix this problem because it is in the dependencies of react-pdf-js that this issue arises (https://github.com/mikecousins/react-pdf-js/pull/62/files), however, it still stands that isn't it a bad idea to use the pdf.combined.js file? It seems like so much bloat is in there? And like I said, that polyfill/hijacking of Object.defineProperty seems to behave differently from native Object.defineProperty.
from react-pdf-js.
I have merged and released the change to hardcode the version to the old one.
I like this talk about switching away from pdf.combined but I'm unsure of the ramifications of it.
from react-pdf-js.
@mikecousins We should indeed get rid of the pdf.combined
🙂
Since the provided polyfills won't be included anymore, that would be a major version bump.
from react-pdf-js.
Related Issues (20)
- Add possibility to load all document pages HOT 1
- Can we use it in class based components? HOT 1
- Render whole pdf file vertically and navigate between pages with scroll HOT 3
- Android browsers are not supported HOT 1
- Pdfjs-dist 'unexpected token' error with Jest HOT 5
- Can you re-build a new version to npm ? we need those last commit in , still can't us it HOT 10
- can not preview local file HOT 1
- Error when installing version 6.1.1 HOT 11
- There seems to be no page zooming function. HOT 1
- https://pdf.netlify.com HOT 1
- npm run start Error, when i use Umijs HOT 1
- Responsive Problem HOT 1
- When using Yarn installation, an error will be reported HOT 2
- Can we have download button HOT 2
- output of the PDF after rendering HOT 1
- SetScale is not working if we set the initial values to the scale HOT 1
- can we display multiple pages in once instead of put next previous page button HOT 2
- PDF Worker used CDN URL HOT 1
- When an error occurs in the url request provided, the page will report an error directly.
- Error rendering page with NextJS (14.0.3, 14.0.4 and 14.1.0) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-pdf-js.