ng2-pdf-viewer: 2.0.0+ doesn't work with ssr
Hi!
Everything is working fine using webpack and ssr with the version 1.2.7. However since version 2.0.0 I get the following error when I start my dist/server.js file.
window['pdfjs-dist/build/pdf'] = pdfjs;
^
ReferenceError: window is not defined
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 17 (3 by maintainers)
Commits related to this issue
- Merge pull request #216 from VadimDez/feature/#173 Feature/#173 — committed to VadimDez/ng2-pdf-viewer by VadimDez 7 years ago
Hi. I have problem in universal with the error Element is not defined. I found that the problem is for this component. Any Idea to fix that?
Any news about SSR support ?
Would definitely save me some time if somebody provides a repo where i can reproduce this issue.
@hesampour @arsenlol @shahbazkhan054
We encountered the same problem, and fixed it in prerender.ts & server.ts by adding the following lines:
+1 for previous comment: webpack:///./node_modules/pdfjs-dist/build/pdf.js?:1080 if (typeof Element.prototype.remove !== ‘undefined’) {
ReferenceError: Element is not defined
I’m currently searching for an PDF viewer that supports Angular Universal. Are there any news on this issue? Would a reproduction repository help?
I don’t really need PDF viewer on server side - maybe a simple solution would be to provide a noop-Module like the noopanimationsmodule…
up