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

loading with requirejs cause error #58

Closed
tariqinaam opened this issue Feb 22, 2017 · 7 comments · Fixed by #62
Closed

loading with requirejs cause error #58

tariqinaam opened this issue Feb 22, 2017 · 7 comments · Fixed by #62

Comments

@tariqinaam
Copy link

tariqinaam commented Feb 22, 2017

Trying to use html5-skin project (https://github.com/ooyala/html5-skin ) which has dependency of deepmerge.
When loading html5-skin via requirejs, it causes Mismatched anonymous define() module: function ()`
Is there anything i need to do to use this library via requirejs...
It works fine when loading wihtout requirejs..

@TehShrike
Copy link
Owner

What's spitting out the error message? I'm not familiar with requirejs I'm not sure what would cause the issue.

Are there any more details in the error message? Can you get requirejs to give you a more verbose error message?

Duplicate ooyala/html5-skin#730

@TehShrike
Copy link
Owner

I'm guessing it has something to do with deepmerge using the UMD pattern so that the module works with the browser, CommonJS, and AMD. But then it's getting bundled in a CommonJS environment in html5-skin, and then you try to load the whole thing from an AMD environment.

@TehShrike
Copy link
Owner

@tariqinaam
Copy link
Author

tariqinaam commented Feb 27, 2017

Yh, i think thats the issue. I have tried all possible way. but no luck.
I think the way it bundle, requirejs not able to see deepmerge and it throws error as deepmerge doesn't exist.

the exact error i get is deepmerge is not a function.

@TehShrike
Copy link
Owner

Maybe we should put the actual code in its own file, and bundle a "dist" version with the UMD pattern for publishing.

Then we could add browser and module fields to the package.json, pointing to the stand-alone file, so that bundlers would use it, and we could leave the main property pointing at the UMD version.

That way, bundlers wouldn't pull in the UMD pattern with the rest of the code.

Any thoughts?

@tariqinaam
Copy link
Author

yes, we could give it a try.
I am a backend Dev and very little exp with FE, so can't really give my input on this. sorry.
can you plz suggest how to bundle this.

@TehShrike
Copy link
Owner

The bundler changes were published in 1.4.0.

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

Successfully merging a pull request may close this issue.

2 participants