mirror of
https://github.com/Unkn0wnCat/data-toolbox-site.git
synced 2025-04-28 09:36:24 +02:00
Add react-snap
This commit is contained in:
parent
f12f715a97
commit
fa6b8b99ca
3 changed files with 547 additions and 42 deletions
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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,15 +9,26 @@ import './i18n';
|
|||
|
||||
serviceWorkerRegistration.register();
|
||||
|
||||
const root = createRoot(
|
||||
document.getElementById('root')!
|
||||
);
|
||||
|
||||
root.render(
|
||||
if (document.getElementById('root')?.hasChildNodes()) {
|
||||
const root = hydrateRoot(
|
||||
document.getElementById('root')!,
|
||||
<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
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
|
|
Loading…
Add table
Reference in a new issue