rubyjs / therubyracer

Embed the V8 Javascript Interpreter into Ruby
1.66k stars 193 forks source link

Could we use therubyracer and mini_racer at the same time? #437

Closed Roger-Tong closed 7 years ago

Roger-Tong commented 7 years ago

Now mini_racer has dependency on libv8: spec.add_dependency 'libv8', '~> 5.3' therubyracer has dependency on libv8: gem.add_dependency 'libv8', '~> 3.16.14.15' It cannot be used within one project at the same time from the dependency's point of view.

We used a workaround to update Gemfile.lock manually as below (~> was changed to >, and we didn't use the latest version of therubyracer):

    therubyracer (0.10.1)
      libv8 (> 3.3.10)

It make bundler to download libv8 (version: 5.3.332.38.3). But it still makes therubyracer work. Does it mean https://github.com/cowboyd/therubyracer/blob/master/therubyracer.gemspec could be updated as gem.add_dependency 'libv8', '=> 3.16.14.15' ?

ignisf commented 7 years ago

Hi,

That's an interesting question. No -- the answer is that at this point trr and mini_racer depend on incompatible versions of V8's API. The old version of TRR you're mentioning could in theory by chance use a subset of V8's API that has survived for years though I doubt it.

Whatever the case you should really use either TRR or mini_racer because the chance that they'll ever depend on a common subset of V8's historically unstable API seem quite low.

Roger-Tong commented 7 years ago

Using only one runtime should be the right way. Our problem is that Less-rails has to use TTR(https://github.com/metaskills/less-rails/issues/136), but we want to take advantage of mini_racer to faster our server rendering suggested by react_on_rails. So it seems using both of them is the only way for us now.