Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fuzzy-fans-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'preact-cli': patch
---

Fixes bug causing wrong port to be given to Webpack config
7 changes: 4 additions & 3 deletions packages/cli/lib/lib/webpack/run-webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ const transformConfig = require('./transform-config');
const { error, isDir, warn } = require('../../util');

async function devBuild(env) {
let userPort = parseInt(process.env.PORT || env.port, 10) || 8080;
env.port = await getPort({ port: userPort });

let config = await clientConfig(env);

await transformConfig(env, config);

let userPort =
parseInt(process.env.PORT || config.devServer.port, 10) || 8080;
let port = await getPort({ port: userPort });
let port = config.devServer.port;

let compiler = webpack(config);
return new Promise((res, rej) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/lib/webpack/webpack-client-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ function isDev(config) {
publicPath: '/',
contentBase: src,
https: config.https,
port: process.env.PORT || config.port || 8080,
port: config.port,
host: process.env.HOST || config.host || '0.0.0.0',
disableHostCheck: true,
historyApiFallback: true,
Expand Down