jwhitley / requirejs-rails

RequireJS support for your Rails 3 or 4 application
MIT License
592 stars 199 forks source link

Map configuration in almond builds #159

Open pascalw opened 10 years ago

pascalw commented 10 years ago

Hi @jwhitley,

first of all thanks for your work on this project, it's been working great for me.

One thing I'm having trouble with though is using map in almond builds.

This is my requirejs.yml:

shim:
  zepto:
    exports: '$'

map:
  '*':
    jquery: 'zepto'

In development this works a treat, but if I create a production build with config.requirejs.loader = :almond set, I get a javascript error saying "backbone missing jquery".

Now I noticed that during development the requirejs_include_tag generates a requirejs runtime config based on requirejs.yml. It appears that it doesn't include this in the almond single file build, is that how it's supposed to work?

If I add the map config to my javascript manually like so it works:

c = {"map":{"*":{"jquery":"zepto"}}}
require.config(c)

Please let me know if you need any more information.

carsomyr commented 10 years ago

@pascalw Sorry for the belated reply. I am currently looking adding config information for almond.js builds. The cause of the issue is that the config information isn't populated in the first place.