Home › Forums › Classic DFFS › Require js still not working
- This topic has 3 replies, 2 voices, and was last updated 7 years, 4 months ago by Eike Ahmels.
-
AuthorPosts
-
-
July 18, 2017 at 09:22 #17315
Hello Alexander,
your require.js solutions isnt working proper. We are facing problems:
1. if a file has 2 dots in it (“pdf.worker.js”) and (“pdf.js”) require js loads the non-AMD module “pdf” twice
2. i changed the name of the file to pdf_worker, which loads it, but the global variable PDFJS is not present.i saw you configured the shim config so that it always says true (exports: “spjs”), the exports options is there to check if the file registered the object correct.
I made a solution that worked great, i will send it to you later the day, so you can see what i did different.
Regards
Eike Ahmels -
July 18, 2017 at 09:35 #17319
Thanks for the feedback. Yes, I used the shim config to try to support non-amd modules loading also and wanted to make a “universal” support without the need to supply the module name and export manually – and to try to make it backwards compatible when upgrading from an older version of DFFS.
I’m not really friends with require.js right now so I hope your code will help me get it right.
Alexander
-
July 18, 2017 at 09:39 #17321
I fixed it like 2 seconds after i made the post.
You are loading non-AMD js correct. The main problem was the pdf.js, it got changed to a AMD js and is registering itself but removes the global PDFJS variable.
Thats why i cant get it to work. I got it to work with require([“module”], …) stuff. I tried that before, but i missed the correct module name, which i found out now.Regards
Eike Ahmels -
July 18, 2017 at 09:47 #17323
I am sorry, i thought pdf.js is non-AMD, but they changed it and notified nobody realy well…
I am not good with require.js neither, i realy dont like it atm, not because its bad (i guess its good), but because we are forced to use it on SPO without any notification as well.
Your code is good, i added a little, to make it more consistent and i added a option to define a exports variable for the shim config.
And you need to change a little, so that double dots (or more dots) wont affect files like pdf.worker.js and pdf.js, where only pdf.js gets loaded, because it overrides pdf.worker.js, which gets registered as “pdf” in the shim config.
I guess you dont need my code, its a little messy, because we needed a quick fix, and your solution is more clean and works as great as mine did.
Regards
Eike Ahmels
-
-
AuthorPosts
- You must be logged in to reply to this topic.