-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Labels
issue: bugIssue reporting a bugIssue reporting a bugseverity: lowIf the issue only affects a very niche base of users and an easily implemented workaround can solveIf the issue only affects a very niche base of users and an easily implemented workaround can solvesource: core:adminSource is core/admin packageSource is core/admin packagestatus: confirmedConfirmed by a Strapi Team member or multiple community membersConfirmed by a Strapi Team member or multiple community members
Description
Bug report
Describe the bug
Specifying port field in ./config/admin.js doesn't have any effect and webpack dev server still starts on port 8080.
Steps to reproduce the behavior
- Create new strapi app with
yarn create strapi-app my-project - Set
port: 3000field in ./config/admin.js. see - Run strapi with
--watch-adminflag. - Strapi opens http://localhost:8080/ url in browser and writes to terminal:
<i> [webpack-dev-server] Project is running at: <i> [webpack-dev-server] Loopback: http://localhost:8080/ ...
Expected behavior
Strapi starts on http://localhost:3000/
Code snippets
The issue is how Strapi configures and runs webpackDevServer at this line https://github.com/strapi/strapi/blob/master/packages/core/admin/index.js#L246. According to webpack doc, the start function doesn't expect any params. host and port should be set in devServer config.
Setting port in ./admin/webpack.config.js worked for me:
module.exports = (config, webpack) => {
config.devServer = {
...config.devServer, // this is actually `undefined`, but just in case:)
port: 3000,
};
return config;
};
System
- Node.js version: v14.18.1
- NPM version: 1.22.4
- Strapi version:
"@strapi/strapi": "4.0.0", - Database: sqlite
- Operating system: macos
m-torin, adampax and godzzo
Metadata
Metadata
Assignees
Labels
issue: bugIssue reporting a bugIssue reporting a bugseverity: lowIf the issue only affects a very niche base of users and an easily implemented workaround can solveIf the issue only affects a very niche base of users and an easily implemented workaround can solvesource: core:adminSource is core/admin packageSource is core/admin packagestatus: confirmedConfirmed by a Strapi Team member or multiple community membersConfirmed by a Strapi Team member or multiple community members