stereobooster / react-snap

đŸ‘» Zero-configuration framework-agnostic static prerendering for SPAs
MIT License
5.04k stars 391 forks source link

page load is slower, audit score is lower #471

Open aquaductape opened 4 years ago

aquaductape commented 4 years ago

I have two applications that are built using create react app. One with react snap, and the other without it. Testing with LightHouse and GTmetrix, the one with react snap resulted in a lower score than the one without it.

source code with react snap source code without react snap

live demo with react snap live demo without react snap

React Snap

Lighthouse 2020-06-05_22-00 GTmetrix 2020-06-05_22-19

Without React Snap

Lighthouse 2020-06-05_22-00_1 GTmetrix 2020-06-05_22-20

react snap index.ts

import "react-app-polyfill/ie11";
import "react-app-polyfill/stable";
import "focus-visible";
import React from "react";
import { hydrate, render } from "react-dom";
import "./scss/index.scss";
import App from "./App";
import * as serviceWorker from "./serviceWorker";

const rootElement = document.getElementById("root");
if (rootElement && rootElement.hasChildNodes()) {
  hydrate(<App />, rootElement);
} else {
  render(<App />, rootElement);
}

react snap package.json

...
  "scripts": {
    "start": "react-scripts start",
    "build": "GENERATE_SOURCEMAP=false react-scripts build",
    "postbuild": "react-snap",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "reactSnap": {
    "inlineCss": true
  },
...

without react snap index.ts

import "react-app-polyfill/ie11";
import "react-app-polyfill/stable";
import "focus-visible";
import React from "react";

import ReactDOM from "react-dom";
import "./scss/index.scss";
import App from "./App";
import * as serviceWorker from "./serviceWorker";

ReactDOM.render(<App />, document.getElementById("root"));

no postBuild or reactSnap in package.json

ricky11 commented 2 years ago

the page size is still the same 700 kb for index.html?