maccman / sprockets-commonjs

Adds CommonJS support to Sprockets
178 stars 66 forks source link

rake assets:precompile returned the error 'can't modify immutable index' #3

Closed nvh closed 12 years ago

nvh commented 12 years ago

By using an initializer block, this issue is fixed

nvh commented 12 years ago

The second commit is just a bit of cleaning up. The commit message is pretty self-explanatory

maccman commented 12 years ago

The trouble with this fix is that's it's Rails specific. In other words the commonjs.js file is not going to be picked up for situations in which your'e not using Rails. What version of Rails are you seeing this error on?

nvh commented 12 years ago

The file is encapsulated by if defined?(Rails), so I don't think that should be a problem. I agree that commit a26890f maybe is a bit Rails specific, but It's also not a weird place to put the javascript file

I should probably have created a different request for commit a26890f, that one is not essential for the fix of this problem

I'm using Rails 3.2.3

subblue commented 12 years ago

I'm seeing this issue with Rails 3.2.3 too.

maccman commented 12 years ago

I still can't reproduce this problem :(

subblue commented 12 years ago

Maccam, if it helps this is my gemfile from a freshly created Rails app: https://gist.github.com/2794327

and this is the stack trace when running: rake assets:precompile https://gist.github.com/2794324

and I've just added the commonjs line at the top of my index.js.coffee file (I'm trying Spine with Rails after seeing your excellent Stylo project!)

= require sprockets/commonjs

maccman commented 12 years ago

@nvh Ah, good - I can reproduce it now. Can you put #a26890f in a different commit and I'll merge this?

nvh commented 12 years ago

Sorry for my delay in reaction, thanks for pulling!