State of the project
See original GitHub issueDoes someone else want to take this idea and run with it? I would be 100% happy to not be the maintainer of this project 😃
What are your current plans? I’m asking because there is react-snap, which is a tool inspired by react-snapshot, but uses puppeteer
. Because it uses puppeteer it does not have most of the bugs currently opened in react-snapshot.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
The States Project
The States Project connects the importance of state legislatures to every aspect of our lives and brings together communities to help build a...
Read more >Measuring the State of Your Project
Project state helps figure out whether the team remains aligned with the priority items, expected ROI is met, the quality of the final...
Read more >Project States - PTC Support
When referring to projects or programs, its state is an indicator of the stage of operation and activity. If using automatic execution, only...
Read more >How to Measure the State of Your Project
This article discusses a framework and considerations for measuring project status. Objectives and metrics are suggested. Each organization ...
Read more >State project Definition: 117 Samples | Law Insider
State project means an existing project for which the authority to operate is a time-limited water right for the use of wa- ter...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey! Thanks for taking this idea and running with it. I have been really lacking in time to maintain this project, but I really love this idea.
I’ve basically gone back to the drawing board to think about how this could work in a React16+ environment with async data requirements, even to the point of doing on-demand snapshots as an alternative to SSR, all of which has lead me to wonder what the correct direction to take is.
Perhaps we should have a chat about combining our efforts. I’m much interested in potential React-specific optimisations, perhaps I could be building on top of react-snap instead of competing with it…
react-snap
vsreact-snapshot
react-snapshot
usesjsdom
so it supports only limited browser API(1), on the other sidejsdom
is more lightweight than a real browser e.g. chrome (puppeteer
). A real browser uses more memory, CPU (?), network(2), uses a separate process which introduces additional overhead (?) and npm package much heavier - it downloads chrome binary (3).(1) we can expose callback before page evaluated, so a user can provide polyfills https://github.com/geelen/react-snapshot/issues/93 (2) this can be fixed by blocking some network requests (3) this step can be skipped, but this is not supported by
react-snap
as of nowjsdom limitations
Examples: https://github.com/geelen/react-snapshot/issues/93, https://github.com/geelen/react-snapshot/issues/85, https://github.com/geelen/react-snapshot/issues/50, https://github.com/geelen/react-snapshot/issues/40, https://github.com/geelen/react-snapshot/issues/33, https://github.com/ant-design/ant-design/issues/7341
Async snapshots
See https://github.com/geelen/react-snapshot/pull/30. I believe there are two good approaches here:
networkidle
This is what
react-snap
uses. This technique is proved to be powerful enough to work in many cases without additional configuration. This is built-in puppeteer functionality - consider navigation to be finished when there are no more than 0 network connections for at least 500 ms.Theoretically, it is possible to implement it for
react-snapshot
.renderComplete
This idea was taken from Rendertron. The first call to
renderComplete
will disable default mechanism e.g.networkidle
and prerenderer will start to wait for the second signal. It will be up to the user to implement when to call this function. Related: react#1739, react-transmitOther limitations
React
react-snapshot
is limited to React only projects.react-snap
is framework agnosticCritical CSS
react-snap
can inline critical CSS. It is possible to do this inreact-snapshot
because the core of minimalcss (which is used byreact-snap
) based on cheerio and csstree.webpack code splitting
Currently, create-react-app configured webpack code splitting doesn’t work with prerenderes out of the box. Need to implement a fix for it. Or change c-r-a to use
chunksSortMode: 'dependency'
other performance optimizations
I believe it will be possible to replicate those in
react-snapshot
.ReactDOMServer
Current implementation of
react-snapshot
bringsReactDOMServer
to the client. See https://github.com/geelen/react-snapshot/pull/91Difference in conventions
react-snap
generates/a/b/index.html
for both/a/b
and/a/b/
. I believe this is less confusingreact-snap
generates/404.html
if there is more than one pagereact-snap
does not haveignore
optionreact-snap
exposessnapSaveState
callback to be able to save a state of Redux, async components etc.Maybe there are other small differences which I forgot
conclusion
I believe there is a niche for
jsdom
based prerenderer, but it needs more work. If we decide to continue work onjsdom
based prerenderer it would be nice to use same conventions so two tools can be swaped without additional work