Commit 100ebea6 authored by 张烨's avatar 张烨

feat: 二级路由打包部署

parent c3ff8b48
PROXY=http://192.168.19.102:8005/ # PUBLIC_PATH = reactOMS
HOST=localhost PROXY = http://192.168.19.102:8005/
PORT=3001 HOST = localhost
\ No newline at end of file PORT = 3001
\ No newline at end of file
...@@ -7,7 +7,7 @@ module.exports = options => ({ ...@@ -7,7 +7,7 @@ module.exports = options => ({
output: Object.assign( output: Object.assign(
{ {
path: path.resolve(process.cwd(), 'build'), path: path.resolve(process.cwd(), 'build'),
publicPath: '/', publicPath: process.env.PUBLIC_PATH || '/reactOMS',
}, },
options.output, options.output,
), // Merge with env dependent settings ), // Merge with env dependent settings
......
...@@ -18,8 +18,8 @@ module.exports = require('./webpack.base.babel')({ ...@@ -18,8 +18,8 @@ module.exports = require('./webpack.base.babel')({
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets // Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
output: { output: {
filename: '[name].[chunkhash].js', filename: 'static/[name].[chunkhash].js',
chunkFilename: '[name].[chunkhash].chunk.js', chunkFilename: 'static/[name].[chunkhash].chunk.js',
}, },
optimization: { optimization: {
......
...@@ -12,7 +12,7 @@ export default function App() { ...@@ -12,7 +12,7 @@ export default function App() {
<Helmet titleTemplate="%s - 运维平台" defaultTitle="运维平台"> <Helmet titleTemplate="%s - 运维平台" defaultTitle="运维平台">
<meta name="description" content="运维平台" /> <meta name="description" content="运维平台" />
</Helmet> </Helmet>
<Router> <Router basename={process.env.PUBLIC_PATH || 'reactOMS'}>
<Switch>{renderRoutes(config.routes)}</Switch> <Switch>{renderRoutes(config.routes)}</Switch>
</Router> </Router>
</> </>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment