Skip to content

Commit deb8b62

Browse files
committedApr 10, 2021
update razzle example
1 parent e856175 commit deb8b62

File tree

3 files changed

+24
-19
lines changed

3 files changed

+24
-19
lines changed
 

‎example/razzle-ssr/package.json

+18-9
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,27 @@
66
"start": "razzle start",
77
"build": "razzle build",
88
"test": "razzle test --env=jsdom",
9+
"start:static": "serve -s build/public",
910
"start:prod": "NODE_ENV=production node build/server.js"
1011
},
1112
"dependencies": {
12-
"razzle": "3.1.3",
13-
"react": "16.13.1",
14-
"react-dom": "16.13.1",
13+
"babel-preset-razzle": "4.0.4",
14+
"express": "4.17.1",
15+
"html-webpack-plugin": "5.3.1",
16+
"i18next": "20.2.1",
17+
"i18next-browser-languagedetector": "6.1.0",
18+
"i18next-fs-backend": "1.1.1",
19+
"i18next-http-backend": "1.2.1",
20+
"i18next-http-middleware": "3.1.1",
21+
"mini-css-extract-plugin": "1.4.1",
22+
"razzle": "4.0.4",
23+
"razzle-dev-utils": "4.0.4",
24+
"react": "17.0.2",
25+
"react-dom": "17.0.2",
26+
"react-i18next": "11.8.12",
1527
"react-router-dom": "5.2.0",
16-
"react-i18next": "11.4.0",
17-
"i18next": "20.0.0",
18-
"i18next-browser-languagedetector": "5.0.0",
19-
"i18next-http-middleware": "3.0.0",
20-
"i18next-fs-backend": "1.0.6",
21-
"i18next-http-backend": "1.0.15"
28+
"serve": "11.3.2",
29+
"webpack": "5.31.2",
30+
"webpack-dev-server": "3.11.2"
2231
}
2332
}

‎example/razzle-ssr/src/App.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import React from 'react';
2-
import Route from 'react-router-dom/Route';
3-
import Switch from 'react-router-dom/Switch';
2+
import { Route, Switch } from 'react-router-dom';
43
import Home from './Home';
54
import './App.css';
65

7-
function App() {
6+
function App() {
87
return (
98
<Switch>
109
<Route exact path="/" component={Home} />

‎example/razzle-ssr/src/client.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import App from './App';
2-
import BrowserRouter from 'react-router-dom/BrowserRouter';
1+
import { BrowserRouter } from 'react-router-dom';
32
import React, { Suspense } from 'react';
43
import { hydrate } from 'react-dom';
54
import { useSSR } from 'react-i18next';
5+
import App from './App';
66
import './i18n';
77

88
const BaseApp = () => {
@@ -14,12 +14,9 @@ const BaseApp = () => {
1414
</BrowserRouter>
1515
</Suspense>
1616
);
17-
}
17+
};
1818

19-
hydrate(
20-
<BaseApp />,
21-
document.getElementById('root'),
22-
);
19+
hydrate(<BaseApp />, document.getElementById('root'));
2320

2421
if (module.hot) {
2522
module.hot.accept();

0 commit comments

Comments
 (0)
Please sign in to comment.