Add react-snap

This commit is contained in:
Kevin Kandlbinder 2022-10-21 15:00:19 +02:00
parent f12f715a97
commit fa6b8b99ca
3 changed files with 547 additions and 42 deletions

View file

@ -37,7 +37,8 @@
"test": "react-scripts test",
"eject": "react-scripts eject",
"tscss": "typed-scss-modules src --watch",
"buildServe": "yarn build && serve -s build --ssl-cert ./192.168.1.150.pem --ssl-key ./192.168.1.150-key.pem"
"buildServe": "yarn build && serve -s build --ssl-cert ./192.168.1.150.pem --ssl-key ./192.168.1.150-key.pem",
"postbuild": "react-snap"
},
"eslintConfig": {
"extends": [
@ -58,6 +59,7 @@
]
},
"devDependencies": {
"react-snap": "^1.23.0",
"serve": "^13.0.2",
"typed-scss-modules": "^6.4.0"
}

View file

@ -1,5 +1,5 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import { createRoot, hydrateRoot } from 'react-dom/client';
import './index.scss';
import App from './App';
import reportWebVitals from './reportWebVitals';
@ -9,6 +9,16 @@ import './i18n';
serviceWorkerRegistration.register();
if (document.getElementById('root')?.hasChildNodes()) {
const root = hydrateRoot(
document.getElementById('root')!,
<React.StrictMode>
<App />
</React.StrictMode>
);
} else {
const root = createRoot(
document.getElementById('root')!
);
@ -18,6 +28,7 @@ root.render(
<App />
</React.StrictMode>
)
}
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))

556
yarn.lock

File diff suppressed because it is too large Load diff