riot / ssr

Riot.js node Server Side Rendering
MIT License
32 stars 8 forks source link

No way to render nested without components object? #6

Closed EdenCoder closed 5 years ago

EdenCoder commented 5 years ago

Is there no way to render nested without components object?

return await render.default(opts.mount.layout, this.components[opts.mount.layout].default, opts);

This only ever renders the root component, though all other compnents are registered within @riotjs/ssr/register

GianlucaGuarini commented 5 years ago

You can simply do

import { register } from 'riot'
// an index file of all your components as array 
// requireDir or webpack.context will work as well
const components = require('./components')

// register all the components globally
components.forEach(component => {
  riot.register(component.name, component)
})