react-rails icon indicating copy to clipboard operation
react-rails copied to clipboard

Prerender Always loads Application.js

Open adrianstainforth opened this issue 11 years ago • 2 comments

It always loads in the application.js, is there anyway to stop it.

I tried being explicit in my application.rb:

config.react.server_renderer_options = {
        files: ["common.js", "components.js"], # files to load for prerendering
        replay_console: true,                 # if true, console.* will be replayed client-side
      }

My application.js has the following:

//= require_self
//= require main
//= require react
//= require react_ujs
//=require components

But it still loads in application.js, I removed the files that had document references (main.js) in it and the pre-render now it works. I'm just wondering if there is anyway to specify what JS files are loaded for pre-rendering, so I can put in any JS I want into application.js without out it effecting the pre-render?

adrianstainforth avatar Nov 17 '15 22:11 adrianstainforth

Sorry, I'm not sure how this happened!

specify what JS files are loaded

Yes, it's the files: option which you are using.

How can you tell that application JS is loaded for server rendering?

Also, what are the //= requires in common.js and components.js ?

rmosolgo avatar Feb 28 '16 14:02 rmosolgo

2.0 will require server_rendering.js by default

rmosolgo avatar Apr 12 '17 15:04 rmosolgo