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", "test": "react-scripts test",
"eject": "react-scripts eject", "eject": "react-scripts eject",
"tscss": "typed-scss-modules src --watch", "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": { "eslintConfig": {
"extends": [ "extends": [
@ -58,6 +59,7 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"react-snap": "^1.23.0",
"serve": "^13.0.2", "serve": "^13.0.2",
"typed-scss-modules": "^6.4.0" "typed-scss-modules": "^6.4.0"
} }

View file

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

556
yarn.lock

File diff suppressed because it is too large Load diff