-
Notifications
You must be signed in to change notification settings - Fork 754
prerender
option with CommonJS-style modules
#124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
ExecJS is used for the server-side rendering. From the repo:
I'm in a similar position and have found some joy with Webpack and building it with an option to expose all the components to the global object. It's still less than ideal when it comes to sharing dependencies though. |
@alexfedoseev check out my answer in #120 it might help you out, I have a similar CommonJS build but I'm using |
@bogdan-dumitru thanks! gonna check out this weekend |
After months of wandering I've came to this approach: https://github.com/alexfedoseev/generator-flux-on-rails |
Hi! I have trouble with
prerender
option.In short
I'm using CommonJS-style modules with Browserify. In browser everything works fine, but server renderer throws an error:
require
/module
is not defined.Verbose
I'm using Gulp and Browserify to pack my js assets.
Here is the js-assets part of my Rails project:
When I use prerender on the server, I got an errors:
require
/module
is not defined.I'm not very familiar with server-side js rendering, but as far as I know
require
&module
should be defined in node env.Here is my Thor generator to create this setup
JS sources listed below.
/app/assets/javascripts/application.js
Links only
bundle.js
(generated by Browserify).//= require bundle
/app/assets/javascripts/components.js
Used only by server renderer.
//= require_tree ./components
/app/assets/javascripts/components/my_component.js
I solved the undefined
module
problem usingif
, but if I'll need torequire
shared mixin or smth else — I'll get an error from the renderer anyway.The text was updated successfully, but these errors were encountered: