From f7a9ef57110a90ccd104d5a94a267ee7d12640f4 Mon Sep 17 00:00:00 2001 From: Barry Low Date: Wed, 17 Oct 2018 00:57:38 -0700 Subject: [PATCH] Fix nested routes --- client/package.json | 2 +- client/src/App.js | 5 +---- client/tools/webpack/webpack.dev.config.js | 11 +++++------ client/tools/webpack/webpack.prod.config.js | 3 ++- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/client/package.json b/client/package.json index 1a8cba979..a60e14ca3 100644 --- a/client/package.json +++ b/client/package.json @@ -5,7 +5,7 @@ "main": "src/index.js", "scripts": { "dev": "NODE_ENV=development webpack-dev-server --hot --port 3100 --config ./webpack.config.js", - "build": "cross-env NODE_ENV=production webpack --mode production --config ./webpack.config.js", + "build": "NODE_ENV=production webpack --mode production --config ./webpack.config.js", "dev_win": "webpack-dev-server --hot --port 3100 --config ./webpack.config.js", "build_win": "webpack --mode production --config ./webpack.config.js", "lint": "prettier-standard 'src/**/*.js'" diff --git a/client/src/App.js b/client/src/App.js index 3c17461ba..a7d17459f 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -1,5 +1,5 @@ import { ApolloProvider } from 'react-apollo' -import React, { Component } from 'react' +import React from 'react' import { Route, BrowserRouter, Switch } from 'react-router-dom' import { hot } from 'react-hot-loader' @@ -39,17 +39,14 @@ export const MasterApp = () => ( }} /> } /> } /> } /> diff --git a/client/tools/webpack/webpack.dev.config.js b/client/tools/webpack/webpack.dev.config.js index 9ec8cb4a0..190acdfb0 100644 --- a/client/tools/webpack/webpack.dev.config.js +++ b/client/tools/webpack/webpack.dev.config.js @@ -2,8 +2,6 @@ const webpack = require('webpack') const Dotenv = require('dotenv-webpack') const path = require('path') const merge = require('webpack-merge') -const history = require('connect-history-api-fallback') -const convert = require('koa-connect') const commonConfig = require('./helpers/webpack.common.config') const HtmlWebpackPlugin = require('html-webpack-plugin') const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin') @@ -15,12 +13,13 @@ module.exports = merge(commonConfig, { output: { path: path.resolve(__dirname, '../../build'), - filename: 'script.js' + filename: 'script.js', + publicPath: '/' }, devServer: { - historyApiFallback: true, - }, + historyApiFallback: true + }, plugins: [ new Dotenv({ @@ -44,5 +43,5 @@ module.exports = merge(commonConfig, { } ] }, - target: 'web', + target: 'web' }) diff --git a/client/tools/webpack/webpack.prod.config.js b/client/tools/webpack/webpack.prod.config.js index b5810a748..9e170e919 100644 --- a/client/tools/webpack/webpack.prod.config.js +++ b/client/tools/webpack/webpack.prod.config.js @@ -15,7 +15,8 @@ module.exports = merge(commonConfig, { devtool: 'inline-sourcemap', output: { path: path.resolve(__dirname, '../../build'), - filename: 'script.js' + filename: 'script.js', + publicPath: '/' }, optimization: {