Ensured react router uses homepage defined in package.jsoin as basename

This commit is contained in:
Alejandro Celaya 2018-11-01 08:20:33 +01:00
parent a65aadd4b2
commit 6784c30fa0
3 changed files with 7 additions and 3 deletions

View file

@ -3,6 +3,7 @@
"description": "A React-based progressive web application for shlink", "description": "A React-based progressive web application for shlink",
"version": "1.0.0", "version": "1.0.0",
"private": false, "private": false,
"homepage": "",
"scripts": { "scripts": {
"lint": "yarn lint:js && yarn lint:css", "lint": "yarn lint:js && yarn lint:css",
"lint:js": "eslint src test scripts config", "lint:js": "eslint src test scripts config",

View file

@ -4,17 +4,19 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="theme-color" content="#4696e5"> <meta name="theme-color" content="#4696e5">
<!-- <!--
manifest.json provides metadata used when your web app is added to the manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
--> -->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="apple-touch-icon" href="%PUBLIC_URL%/icons/shlink-128.png"> <link rel="apple-touch-icon" href="%PUBLIC_URL%/icons/shlink-128.png">
<link rel="apple-touch-icon" sizes="64x64" href="%PUBLIC_URL%/icons/shlink-64.png"> <link rel="apple-touch-icon" sizes="64x64" href="%PUBLIC_URL%/icons/shlink-64.png">
<link rel="apple-touch-icon" sizes="32x32" href="%PUBLIC_URL%/icons/shlink-32.png"> <link rel="apple-touch-icon" sizes="32x32" href="%PUBLIC_URL%/icons/shlink-32.png">
<link rel="apple-touch-icon" sizes="24x24" href="%PUBLIC_URL%/icons/shlink-24.png"> <link rel="apple-touch-icon" sizes="24x24" href="%PUBLIC_URL%/icons/shlink-24.png">
<link rel="apple-touch-icon" sizes="16x16" href="%PUBLIC_URL%/icons/shlink-16.png"> <link rel="apple-touch-icon" sizes="16x16" href="%PUBLIC_URL%/icons/shlink-16.png">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!-- <!--
Notice the use of %PUBLIC_URL% in the tags above. Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build. It will be replaced with the URL of the `public` folder during the build.

View file

@ -5,6 +5,7 @@ import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom'; import { BrowserRouter } from 'react-router-dom';
import { applyMiddleware, compose, createStore } from 'redux'; import { applyMiddleware, compose, createStore } from 'redux';
import ReduxThunk from 'redux-thunk'; import ReduxThunk from 'redux-thunk';
import { homepage } from '../package.json';
import App from './App'; import App from './App';
import './index.scss'; import './index.scss';
import ScrollToTop from './common/ScrollToTop'; import ScrollToTop from './common/ScrollToTop';
@ -22,7 +23,7 @@ const store = createStore(reducers, composeEnhancers(
render( render(
<Provider store={store}> <Provider store={store}>
<BrowserRouter> <BrowserRouter basename={homepage}>
<ScrollToTop> <ScrollToTop>
<App /> <App />
</ScrollToTop> </ScrollToTop>