Closed YaromichSergey closed 2 months ago
I've set pdfDefaultOptions.assetsFolder = 'http://127.0.0.1:4200/assets'
and now it loads the pdf.js resource files from "127.0.0.1" (instead of using "localhost"). So I don't think there's a bug. What does your configuration look like?
All resource files loaded from assetsFolder except of locale. We have something like https://{dynamicname}.domain.com. All resources we want to take from https://static.domain.com. We faced with issue with cache so we decided to make own version for assets. And full assetsFolder looks like 'https://static.domain.com/assets/version19_5' and in angular.json move files to assets/version19_5.Files 'mjs' works fine, but assets(also locally) trying to request from /assets/locale. We expect /assets/version19_5/locale.
Hi, any other news about this?
I'm afraid I don't have any news. I don't know how to reproduce your issue. And it's hard to solve an issue I can't see. Maybe you can help me with an idea how to reproduce it?
Steps to reproduce:
Looks like assets/locale hardcoded and not related to assetsFolder variable.
assetsFolder it's sample how we want to use it. In localhost, i try to emulate to show you, what I'm expecting. Hope you undestand idea and it might be enough.
I've followed your steps and ended up with https://github.com/stephanrauh/ngx-extended-pdf-viewer-issues/tree/main/issue2259. It works flawlessly. Can you clone or download my reproducer and check whether it works on your machine, too? That should enable you to hunt down the difference between your project and my project.
That works fine on your project. But when I'm trying to use on own, still have
Could you make your changes to branch and we try to use them? Or mb you have any other ideas? using in angular.json using inside component
Am I missing something?
I don't have a clue. You can set [minifiedJSLibraries]="false"
and debug the source code to find out where the locale path is set. It's probably in the viewer-*.mjs
file:
static async #getPaths() {
try {
const { href } = document.querySelector(`link[type="application/l10n"]`);
const paths = await fetchData(href, /* type = */ "json");
return { baseURL: href.replace(/[^/]*$/, "") || "./", paths };
} catch {}
return { baseURL: "./", paths: Object.create(null) };
}
``´
Did you make any progress? I don't want to let you down, but I really don't have a clue how to help you.
You've mentioned it works in my project, and I assume that means you've cloned my project and it works on your machine, too. So it's almost certainly not a problem of my library. Hence, I'm closing the ticket now.
That's doesn't mean I'll stop supporting you. Feel free to add comments to the tickets, and I'll read and answer them. I still hope we'll figure it out together!
Best regards, Stephan
Trying to use library files from different domain to cache it. pdfDefaultOptions.assetsFolder setting to static.domain.com for example but locale(locale.json) files requested from current(mydomain.com/assets/locale/locale.json). Is it possible to also ask locale from assetsFolder? It's bug?