Skip to content

Commit

Permalink
fix: 支持自定义域名
Browse files Browse the repository at this point in the history
  • Loading branch information
senwii committed Mar 9, 2020
1 parent 583f202 commit 7f7112a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {
Route,
} from "react-router-dom"

import routes, { basename } from './router'
import routes from './router'

function App() {
return (
<div className="root">
<BrowserRouter basename={ basename }>
<BrowserRouter>
<Switch>
{
routes.map((route:any, index) => (
Expand Down
6 changes: 0 additions & 6 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,4 @@ const routes = [
},
]

const basename = `/${process.env.PROJECT_NAME}/`

export {
basename,
}

export default routes
4 changes: 0 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const webpack = require('webpack')
const appDirName = process.cwd()
const packageName = require(`${appDirName}/package.json`).name
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
Expand Down Expand Up @@ -33,9 +32,6 @@ const plugins = [
flatten: true,
},
]),
new webpack.DefinePlugin({
'process.env.PROJECT_NAME': JSON.stringify(packageName),
}),
]

if (IS_PRODUCTION) {
Expand Down

0 comments on commit 7f7112a

Please sign in to comment.