0

When running a Dart web app in WebStorm, the "Pub Serve" tab on the ? pane at the bottom reports the following (--port differs from run to run):

/home/tom/dart-sdk/bin/pub serve web --port=46247
Loading source assets...
Loading polymer transformers...
Serving polymer_and_dart web on http://localhost:46247

However, the app will be accessible at http://localhost:63342.

Yet when I run pub serve from the command line, the app will be accessible at localhost:46247:

/home/tom/dart-sdk/bin/pub serve web --port=46247

Can someone explain what WebStorm is doing at the specified port, if it is not to serve the app?

BTW, I am using only Dartium in development.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Tom Russell
  • 1,015
  • 2
  • 10
  • 29

2 Answers2

2

WebStorm has an integrated proxy that listens on its own port and just forwards to the port pub serve is listening on.

pub serve will be removed in Dart 2.

Currently 4/2018 there is no integration of pub run build_runner serve with IntelliJ but it is work in progress.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
2

Webstorm 2018.1 seems to do something a little different from a proxy. Webstorm runs a web server at the debug port that will respond with a 302 redirect when it receives a GET http://localhost:{{debugPort}}/web/web/{{targetPage}}. The redirect's Location header will refer to the actual location of the target page in the Dart web app.

If, by some chance you need to get the random port programmatically during development, you can enable "Allow unsigned requests" in the Webstorm debugger settings and then write some scaffolding code to get the Location header.

Grant BlahaErath
  • 2,630
  • 2
  • 17
  • 12