Skip to content

Ability to prerender via CLI #27

Open
@Ezku

Description

@Ezku

Hi,

I have a use case where I want to prerender a react app as part of a build pipeline for static deployment. I'm using parcel for the build step, which means I can't use e.g. prerender-spa-plugin. But your documentation made prerendering seem simple enough I was wondering - why not rig up a CLI script and run prerendering that way?

I'm not sure if this is the right place to tell you about this, but here's a proof of concept that works perfectly for my use case: https://github.com/Ezku/prerenderer-cli

In short, in my project I have a package.json like this:

"scripts": {
    "build": "yarn build:parcel && yarn build:prerender",
    "build:parcel": "yarn parcel build ./src/index.html",
    "build:prerender": "yarn prerender --renderer=jsdom --source=dist --target=dist --renderAfterDocumentEvent=react-render-complete index.html"
  },

Which yields parcel'd and prerender'd output in dist, the default output directory for parcel. I don't need to write any code in the project for this to happen because prerenderer-cli is quite enough.

What do you think? Is this interesting to you? Thanks for the great tool, I'm liking it a lot at this point.

Cheers,
Eevert

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions