-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
Producing massive webpack bundles #284
Comments
Are you using custom |
I've tried it without workerSrc and also with workerSrc. My current is:
But that is a directive for the browser. I don't think it would have any effect on the AOT compiler. |
I realise now that since it's webpack, I can't point directly to node_modules. I've updated it to:
I've confirmed that in the browser, it's now loading pdf.worker.min.js from the local resources/ dir rather than from cloudflare, but there's still that same large pdf.worker chunk in the bundle, which I'm guessing is just redundant code. |
Could you please check whether pdf.worker.js chunk is actually loaded/used? |
Sure thing; the network tab shows that *chunk.js is not being loaded, but /resources/pdf.worker.min.js is. |
I guess pdf.worker.js chunk is loaded (fallback) only when pdf worker is disabled |
Are you referring to pdf webworker? As in, if webworker is disabled, it will use the chunk to render in the normal browser js thread? |
I guess since it isn't being loaded anyway, it isn't really a problem. I'll just stick with dumping the minified worker in my resources dir and pointing to it. Along the lines of the bundle size, there's one thing I'd like to request: could you please provide a way to disable the import of of compatibility.js? My Angular application only supports the latest Firefox and Chrome releases, so I have no need for it to be there. Anywhere I can save space on my bundle size is a good thing :) |
Closing issue as I will now just load worker_min.js from my resources/ dir, and the worker chunk should never get loaded by the client browser. |
Try Adobe Embed APIs: https://www.adobe.com/devnet-docs/dcsdk_io/viewSDK/index.html
|
Thanks very much for this great library!
Using version 4.1.2 of ng2-pdf-viewer, it seems to be producing enormous bundles using "ng-build --prod --aot" (using Angular 5.2 and CLI 1.7.1). Webpack-bundle-analyzer tells me that under *.chunk.js - pdf.worker.js is 1.42 MB and in the main bundle, pdf.js is using 573 K. (screenshot attached).
I found this issue where it was marked as addressed but I've been unable to reduce the size in my case.
I'm certainly open to the possibility that I'm doing something wrong, but I can't think of what.
The text was updated successfully, but these errors were encountered: