diff --git a/common/Root.tsx b/common/Root.tsx index e21c63ba..efafe78c 100644 --- a/common/Root.tsx +++ b/common/Root.tsx @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { Provider } from 'react-redux'; -import { withRouter, Switch, Redirect, Router, Route } from 'react-router-dom'; +import { withRouter, Switch, Redirect, HashRouter, Route, BrowserRouter } from 'react-router-dom'; // Components import Contracts from 'containers/Tabs/Contracts'; import ENS from 'containers/Tabs/ENS'; @@ -15,7 +15,6 @@ import ErrorScreen from 'components/ErrorScreen'; // TODO: fix this interface Props { store: any; - history: any; } interface State { @@ -32,7 +31,7 @@ export default class Root extends Component { } public render() { - const { store, history } = this.props; + const { store } = this.props; const { error } = this.state; if (error) { @@ -40,29 +39,34 @@ export default class Root extends Component { } // key={Math.random()} = hack for HMR from https://github.com/webpack/webpack-dev-server/issues/395 + const routes = ( +
+ + + + + + + + + + + + + + + + + +
+ ); return ( - -
- - - - - - - - - - - - - - - - - -
-
+ {process.env.BUILD_DOWNLOADABLE ? ( + {routes} + ) : ( + {routes} + )}
); } diff --git a/common/index.html b/common/index.html index 81d0f531..52484dc8 100644 --- a/common/index.html +++ b/common/index.html @@ -8,15 +8,7 @@ - - - - - - - - @@ -26,13 +18,11 @@

You Must Enable Javascript to Continue

- MyEtherWallet requires Javascript to run. There are no security - vulnerabilities as a result of enabling Javascript on MyEtherWallet, as - we do not load any external scripts such as advertisements or trackers. + MyEtherWallet requires Javascript to run. There are no security vulnerabilities as a result of enabling Javascript on MyEtherWallet, + as we do not load any external scripts such as advertisements or trackers.

- If you are not sure why you are seeing this message, or are unsure of - how to enable Javascript, please visit + If you are not sure why you are seeing this message, or are unsure of how to enable Javascript, please visit enable-javascript.com to learn more.

@@ -43,43 +33,27 @@

Your Browser is Out of Date

- MyEtherWallet requires certain features that your browser doesn't offer. - Your browser may also be missing security updates that could open you up - to vulnerabilities. Please update your browser, or switch to one of the - following browsers ones to continue using MyEtherWallet. + MyEtherWallet requires certain features that your browser doesn't offer. Your browser may also be missing security updates + that could open you up to vulnerabilities. Please update your browser, or switch to one of the following browsers + ones to continue using MyEtherWallet.

- MyEtherWallet requires certain features that your browser doesn't offer. - Please use your device's default browser, or switch to a laptop or - computer to continue using MyEtherWallet. + MyEtherWallet requires certain features that your browser doesn't offer. Please use your device's default browser, or switch + to a laptop or computer to continue using MyEtherWallet.

- + \ No newline at end of file diff --git a/common/index.tsx b/common/index.tsx index 7f4a9850..17c51cdd 100644 --- a/common/index.tsx +++ b/common/index.tsx @@ -7,21 +7,18 @@ import 'whatwg-fetch'; import React from 'react'; import { render } from 'react-dom'; import Root from './Root'; -import createHistory from 'history/createBrowserHistory'; import { configuredStore } from './store'; import consoleAdvertisement from './utils/consoleAdvertisement'; -const history = createHistory(); - const appEl = document.getElementById('app'); -render(, appEl); +render(, appEl); if (module.hot) { module.hot.accept('reducers', () => configuredStore.replaceReducer(require('reducers'))); module.hot.accept('./Root', () => { - render(, appEl); + render(, appEl); }); } diff --git a/package.json b/package.json index c13bf2b9..31c904b0 100644 --- a/package.json +++ b/package.json @@ -75,9 +75,12 @@ "enzyme-to-json": "3.3.0", "express": "4.16.2", "extract-text-webpack-plugin": "3.0.2", + "favicons-webpack-plugin": "0.0.7", "file-loader": "1.1.6", "friendly-errors-webpack-plugin": "1.6.1", "glob": "7.1.2", + "hoist-non-react-statics": "2.3.1", + "html-webpack-include-assets-plugin": "1.0.2", "html-webpack-plugin": "2.30.1", "husky": "0.14.3", "image-webpack-loader": "3.4.2", @@ -118,7 +121,7 @@ "db": "nodemon ./db", "build": "webpack --config webpack_config/webpack.prod.js", "prebuild": "check-node-version --package", - "build:demo": "BUILD_GH_PAGES=true webpack --config webpack_config/webpack.prod.js", + "build:downloadable": "BUILD_DOWNLOADABLE=true webpack --config webpack_config/webpack.prod.js", "prebuild:demo": "check-node-version --package", "test:coverage": "jest --config=jest_config/jest.config.json --coverage", "test": "jest --config=jest_config/jest.config.json", @@ -135,7 +138,8 @@ "postinstall": "webpack --config=./webpack_config/webpack.dll.js", "start": "npm run dev", "precommit": "lint-staged", - "formatAll": "find ./common/ -name '*.ts*' | xargs prettier --write --config ./.prettierrc --config-precedence file-override", + "formatAll": + "find ./common/ -name '*.ts*' | xargs prettier --write --config ./.prettierrc --config-precedence file-override", "prepush": "npm run tslint && npm run tscheck" }, "lint-staged": { diff --git a/webpack_config/config.js b/webpack_config/config.js index 5a9fb7e2..3b4dda0d 100644 --- a/webpack_config/config.js +++ b/webpack_config/config.js @@ -4,7 +4,7 @@ const path = require('path'); module.exports = { port: process.env.HTTPS ? 3443 : 3000, title: 'MEW', - publicPath: process.env.BUILD_GH_PAGES ? '/react-semantic.ui-starter/' : '/', + publicPath: process.env.BUILD_DOWNLOADABLE ? './' : '/', srcPath: path.join(__dirname, './../common'), // add these dependencies to a standalone vendor bundle vendor: [ @@ -28,11 +28,7 @@ module.exports = { quality: 80 }, svgo: { - plugins: [ - { removeViewBox: true }, - { removeEmptyAttrs: false }, - { sortAttrs: true } - ] + plugins: [{ removeViewBox: true }, { removeEmptyAttrs: false }, { sortAttrs: true }] } } }; diff --git a/webpack_config/webpack.base.js b/webpack_config/webpack.base.js index 0c7947e0..348693b4 100644 --- a/webpack_config/webpack.base.js +++ b/webpack_config/webpack.base.js @@ -3,6 +3,8 @@ const path = require('path'); const webpack = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); +const FaviconsWebpackPlugin = require('favicons-webpack-plugin'); +const HtmlWebpackIncludeAssetsPlugin = require('html-webpack-include-assets-plugin'); const config = require('./config'); const _ = require('./utils'); const { CheckerPlugin } = require('awesome-typescript-loader'); @@ -64,13 +66,18 @@ module.exports = { }, plugins: [ new webpack.DefinePlugin({ - 'process.env.BUILD_GH_PAGES': JSON.stringify(!!process.env.BUILD_GH_PAGES) + 'process.env.BUILD_DOWNLOADABLE': JSON.stringify(!!process.env.BUILD_DOWNLOADABLE) }), new HtmlWebpackPlugin({ title: config.title, template: path.resolve(__dirname, '../common/index.html'), filename: _.outputIndexPath }), + new HtmlWebpackIncludeAssetsPlugin({ assets: ['dll.vendor.js'], append: false }), + new FaviconsWebpackPlugin({ + logo: path.resolve(__dirname, '../static/favicon/android-chrome-384x384.png'), + background: '#163151' + }), new webpack.LoaderOptionsPlugin(_.loadersOptions()), new CopyWebpackPlugin([ {