You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched for existing issues that already include this feature request, without success.
Describe the Feature Request
Add a CLI parameter that will disable the automatic port incrementing behavior when the open port is currently in use. For example, if you ask to bind to port 3003, but ports 3003-3009 are in use, the devServer will currently bind to port 3010.
Describe the Use Case
When working on micro frontends locally, multiple Stencil dev servers may be run in parallel, and an outside process is responsible for coordinating the rendering of the multiple frontends into a single application. In situations like this, it's easy to lose a tab running a dev server and attempt to start up another instance of a micro frontend that's already running a dev server instance. There are many instances where multiple services may need to be run locally and orchestrated together into a larger app, and the common denominator across tech stacks is the ports that the services are bound to. When applications are allowed to roam across ports, it makes it difficult or impossible to enforce that the expected service is running at the port indicated, so the lack of this feature causes conflicts with other technologies as well, since the Stencil dev server can't be a "good citizen" of local port allocation because it can claim ports that may not belong to it.
Describe Preferred Solution
Add a mechanism from the CLI allowing the customization of this behavior. The Vite behavior seems to me like the preferred solution, since it is incrementally enhancing behavior without any backwards incompatibility. Introduce the strictPort option, and default it to false, which will result in identical behavior to Vite and to current Stencil Dev Server. Then implement strictPort as true, which will enable this new behavior.
Describe Alternatives
I am currently using mechanisms outside of the devServer to force the startup scripts to abort if the preferred ports are in use, but this is not required in either Vite or Webpack projects, only for Stencil, it requires extra code, and it is difficult to make it function correctly in a cross-platform way as it depends on additional tooling. Ideally Stencil devServer would support forcing a standard port, as several other common dev servers currently allow.
The config for the CLI would need an additional parameter introduced and documented, perhaps called strictPort and of boolean type.
Additional Information
Vite's dev server as an example has both the port and strictPort CLI properties. port is used to bind to a specific port, identically to Stencil's port property. If strictPort is false, the behavior is the same as the Stencil dev server, where if the preferred port is taken, the next incremented port number that is free is used. If strictPort is true, then the dev server fails to start up if the port binding is not possible on the specified port.
Webpack solves this by either specifying port: auto which has the roaming port behavior, or port: {number} which requires the specified port to be enabled. See the devServer documentation for more details.
The text was updated successfully, but these errors were encountered:
Prerequisites
Describe the Feature Request
Add a CLI parameter that will disable the automatic port incrementing behavior when the open port is currently in use. For example, if you ask to bind to port 3003, but ports 3003-3009 are in use, the devServer will currently bind to port 3010.
Describe the Use Case
When working on micro frontends locally, multiple Stencil dev servers may be run in parallel, and an outside process is responsible for coordinating the rendering of the multiple frontends into a single application. In situations like this, it's easy to lose a tab running a dev server and attempt to start up another instance of a micro frontend that's already running a dev server instance. There are many instances where multiple services may need to be run locally and orchestrated together into a larger app, and the common denominator across tech stacks is the ports that the services are bound to. When applications are allowed to roam across ports, it makes it difficult or impossible to enforce that the expected service is running at the port indicated, so the lack of this feature causes conflicts with other technologies as well, since the Stencil dev server can't be a "good citizen" of local port allocation because it can claim ports that may not belong to it.
Describe Preferred Solution
Add a mechanism from the CLI allowing the customization of this behavior. The Vite behavior seems to me like the preferred solution, since it is incrementally enhancing behavior without any backwards incompatibility. Introduce the
strictPort
option, and default it tofalse
, which will result in identical behavior to Vite and to current Stencil Dev Server. Then implementstrictPort
astrue
, which will enable this new behavior.Describe Alternatives
I am currently using mechanisms outside of the devServer to force the startup scripts to abort if the preferred ports are in use, but this is not required in either Vite or Webpack projects, only for Stencil, it requires extra code, and it is difficult to make it function correctly in a cross-platform way as it depends on additional tooling. Ideally Stencil devServer would support forcing a standard port, as several other common dev servers currently allow.
Related Code
The config for the CLI would need an additional parameter introduced and documented, perhaps called
strictPort
and of boolean type.Additional Information
Vite's dev server as an example has both the port and strictPort CLI properties.
port
is used to bind to a specific port, identically to Stencil'sport
property. IfstrictPort
is false, the behavior is the same as the Stencil dev server, where if the preferred port is taken, the next incremented port number that is free is used. IfstrictPort
is true, then the dev server fails to start up if the port binding is not possible on the specified port.Webpack solves this by either specifying
port: auto
which has the roaming port behavior, orport: {number}
which requires the specified port to be enabled. See the devServer documentation for more details.The text was updated successfully, but these errors were encountered: