Skip to content

Commit 96ccf64

Browse files
Merge branch 'main' of github.com:nanlabs/react-webpack-boilerplate
2 parents 8a13cde + f162667 commit 96ccf64

File tree

7 files changed

+42
-18
lines changed

7 files changed

+42
-18
lines changed

config/webpack.development.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,28 +50,26 @@ const config = {
5050
new WebpackManifestPlugin({
5151
publicPath: `${URL_BASE}/`,
5252
seed: {
53-
name: "app",
54-
short_name: "app",
55-
start_url: "index.html",
56-
display: "standalone",
53+
name: 'app',
54+
short_name: 'app',
55+
start_url: 'index.html',
56+
display: 'standalone',
5757
icons: [
5858
{
59-
src: "favicon.ico",
60-
sizes: "512x512",
61-
type: "image/x-icon"
62-
}
59+
src: 'favicon.ico',
60+
sizes: '512x512',
61+
type: 'image/x-icon',
62+
},
6363
],
64-
background_color: "#4e0041",
65-
theme_color: "#4e0041"
64+
background_color: '#4e0041',
65+
theme_color: '#4e0041',
6666
},
6767
generate: (seed, files, entrypoints) => {
6868
const manifestFiles = files.reduce((manifest, file) => {
6969
manifest[file.name] = file.path;
7070
return manifest;
7171
}, seed);
72-
const entrypointFiles = entrypoints.main.filter(
73-
fileName => !fileName.endsWith('.map')
74-
);
72+
const entrypointFiles = entrypoints.main.filter((fileName) => !fileName.endsWith('.map'));
7573

7674
return {
7775
files: manifestFiles,
@@ -85,9 +83,8 @@ const config = {
8583
from: commonPaths.favicon,
8684
to: commonPaths.outputPath,
8785
},
88-
]
86+
],
8987
}),
90-
new webpack.HotModuleReplacementPlugin(),
9188
],
9289
};
9390

src/i18n.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ i18n
2424
},
2525

2626
// have a common namespace used around the full app
27-
ns: ['translations'],
27+
ns: ['translations', 'config'],
2828
defaultNS: 'translations',
2929

3030
debug: process.env.NODE_ENV === 'development',

src/pages/Home.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import Cracked from 'components/Animation/Cracked';
3+
4+
import './Landing.css';
5+
import { useTranslation } from 'react-i18next';
6+
7+
const Home = () => {
8+
const { t } = useTranslation();
9+
10+
return <Cracked>{t('brand')}</Cracked>;
11+
};
12+
13+
export default Home;

src/pages/Landing.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import React from 'react';
22
import Cracked from 'components/Animation/Cracked';
33

44
import './Landing.css';
5+
import { useTranslation } from 'react-i18next';
56

6-
const Landing = () => <Cracked>app</Cracked>;
7+
const Landing = () => {
8+
const { t } = useTranslation('config');
9+
10+
return <Cracked>{t('app.title')}</Cracked>;
11+
};
712

813
export default Landing;

src/routes/AppRoutes.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import React from 'react';
22
import { Route, Routes } from 'react-router-dom';
33

44
import Landing from 'pages/Landing';
5+
import Home from 'pages/Home';
56

67
const AppRoutes = () => (
78
<Routes>
89
<Route path="/" element={<Landing />} />
10+
<Route path="/nan-labs" element={<Home />} />
911
</Routes>
1012
);
1113

static/locales/en/config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"app": {
3+
"title": "React Webpack Boilerplate"
4+
}
5+
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
{}
1+
{
2+
"brand": "NaNLabs"
3+
}

0 commit comments

Comments
 (0)