Skip to content
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

Integration issues with Magento 2 #37

Open
thanura opened this issue Jun 24, 2019 · 2 comments
Open

Integration issues with Magento 2 #37

thanura opened this issue Jun 24, 2019 · 2 comments

Comments

@thanura
Copy link

thanura commented Jun 24, 2019

We are in the process of integrating uploadcare to our Magento 2 store. I have successfully integrate file uploader using Magneto 2's requirejs. Then I tried to adda the uploadcare tab effects to it where it starts to fail.
So the issue we are having is to do with uploadcare.tab-effects.js is that when I try to include that in to Magento it gives me an error saying uploadcare-widget.js cannot be found. A 404 error thrown by Magento require.js implementation I suppose. So I just debugged it a bit and found out it happens at

typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uploadcare-widget')) :
typeof define === 'function' && define.amd ? define(['uploadcare-widget'], factory) :
(global.uploadcareTabEffects = factory(global.uploadcare));

Then I tried commenting the that bit out and just have,

global.uploadcareTabEffects = factory(global.uploadcare)

Which actually took the 404 issue away. But then it start to complain about "plugin is undefined" error at function uploadcareTabEffects

So this is where I'm now with the integration. Could you please advise me on getting the integration going?

@thanura
Copy link
Author

thanura commented Jun 28, 2019

Any update on this?

@nd0ut
Copy link
Member

nd0ut commented Jul 2, 2019

@thanura Hello!

Unfortunately, I have no idea how JavaScript assets management works in Magento 2 but I'll try to help.

uploadcare-widget-tab-effects module should be loaded with uploadcare-widget as dependency. I think it works just like the jquery plugins in Magento. I found that it should be configured like that:

var config = {
     "shim": {
     "uploadcare-widget-tab-effects": ["uploadcare-widget"]
     }
 };

and then imported in order with requirejs(['uploadcare-widget', 'uploadcare-widget-tab-effects'])

Also you can just include all the uploadcare scripts in the raw html bypassing Magento's requirejs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants