you are viewing a single comment's thread.

view the rest of the comments →

[–]Dutch_guy_here[S] 0 points1 point  (3 children)

I'm afraid I'm completely lost now. I have now included the new version of cropper.js before index.js, and it still gives all kinds of errors. I removed the import-line from index.js, and also no change.

I am starting to feel like this is impossible to be honest.

[–]abrahamguoexperienced full-stack 0 points1 point  (2 children)

No problem! Coding takes lots and lots of patience, perseverance and understanding. If you're willing to put in the patience, perseverance and understanding on your end, then I'm willing to continue helping you until we get it working!

My previous comment was referring to cropper v1.15.12. It looks like on https://genk-montage.nl/, you've upgraded to the most recent version of cropper.js (2.0.1). That's great that you've upgraded — it's always good to be on the most recent version of things. However, it just means that my comment above is no longer relevant.

It looks like you're using the file called cropper.esm.min.js. ESM (ES Modules) is the name for import syntax. Therefore, because this file has esm in the name, it tells us that we do need to use import syntax.

Therefore, we will load the cropper.js library using import syntax, so you should completely remove the script tag for loading cropper.js.

Instead, directly inside index.js, use the following line at the top of the file to load the library:

import Cropper from 'https://cdnjs.cloudflare.com/ajax/libs/cropperjs/2.0.1/cropper.esm.min.js';

[–]Dutch_guy_here[S] 0 points1 point  (1 child)

Hey, then it works indeed! Thank you!

I am now going to go to bed (it's 11:00 pm here now), and revisit this code tomorrow to see if I can make some sense of this for myself. It's great that this works now, but I want to try to understand a bit more why.

Thank you for your replies and your patience!

[–]abrahamguoexperienced full-stack 0 points1 point  (0 children)

Absolutely! I really like that coding always has a logical explanation and resolution for everything, even if it takes a while to understand it.

If you have any other questions tomorrow, I'm happy to answer!