Skip to content

Commit

Permalink
feat: 添加本地服务端口配置
Browse files Browse the repository at this point in the history
  • Loading branch information
kongjing committed Apr 18, 2023
1 parent cb27335 commit be49d2c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
4 changes: 4 additions & 0 deletions packages/doc/config/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export default async function base() {
filename: '[name]_[hash].js',
},

devServer: {
port: base.buildPort,
},

stats: 'normal',

resolve: {
Expand Down
22 changes: 11 additions & 11 deletions packages/doc/scripts/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import path from 'path'
import webpack from 'webpack'
import Server from 'webpack-dev-server'
import getBase from '../config/base'

const devServer = {
port: 7777,
historyApiFallback: true,
open: true,
hot: true,
static: {
directory: path.join(__dirname, './dist'),
},
}

;(async function run() {
process.env['NODE_ENV'] = 'development'
const baseConfig = await getBase()

const devServer = {
port: baseConfig.devServer.port || 7777,
historyApiFallback: true,
open: true,
hot: true,
static: {
directory: path.join(__dirname, './dist'),
},
}

const devConfig = Object.assign(baseConfig, {
mode: 'development',
devtool: 'eval',
Expand Down
1 change: 1 addition & 0 deletions packages/types/doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export type IDocsConfig = {
logo?: string
src: string | string[]
output?: string
buildPort?: number
menu: IDocMenuNavs
route?: IDocRouter
simulator?: IDocSimulator
Expand Down

0 comments on commit be49d2c

Please # to comment.