Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
fix: 修复 devServer 配置无法定制的问题
Browse files Browse the repository at this point in the history
close #1116
  • Loading branch information
noyobo authored and yesmeck committed Jul 9, 2020
1 parent 2dbc4a8 commit f856852
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
10 changes: 1 addition & 9 deletions packages/remax-cli/src/build/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,7 @@ export default function buildWeb(api: API, options: Options): webpack.Compiler {
output.message(`📎 http:https://localhost:${port}`, 'blue');
output.message(`📎 http:https://${address.ip()}:${port}\n`, 'blue');

const server = new WebpackDevServer(compiler, {
publicPath: webpackOptions.output!.publicPath!,
compress: true,
hot: true,
open: false,
historyApiFallback: true,
port,
noInfo: true,
});
const server = new WebpackDevServer(compiler, webpackOptions.devServer);

compiler.hooks.done.tap('web-dev', stats => {
console.log(
Expand Down
12 changes: 12 additions & 0 deletions packages/remax-cli/src/build/webpack/config.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,17 @@ export default function webpackConfig(api: API, options: Options): webpack.Confi

api.configWebpack(context);

const devServer = config.get('devServer');

config.set('devServer', {
publicPath,
compress: true,
hot: true,
open: false,
historyApiFallback: true,
noInfo: true,
...devServer,
});

return config.toConfig();
}

1 comment on commit f856852

@vercel
Copy link

@vercel vercel bot commented on f856852 Jul 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.