Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you use non-AMD libraries with RequireJS?

I know you can use shims to run Backbone.js, for example. But let's say you have a library that behaves worse.

For example, a library that simply declares functions in the global namespace.

Can a library like that be used with RequireJS? If so, how?

like image 900
Joe Avatar asked Oct 22 '22 06:10

Joe


1 Answers

You sure can. RequireJS has a "shim" option in its configuration for just that:

If it has any dependencies, you can list them here and export the global your legacy file usually produces.

like image 166
Alexis Abril Avatar answered Oct 23 '22 22:10

Alexis Abril