'Javafx Webview doesn't load localhost running React app

I use this code to load a React page inside javafx webview.

When im running on localhost >> 'npm start' the webview doesnt load the page, shows blank.

But if I use g serve >> 'npm install -g serve' and 'serve load' the webview works.(is not a solution cause the developing time increase)

public void start(Stage primaryStage) throws Exception {

    WebView webView = new WebView();
    final WebEngine webEngine = webView.getEngine();
    Scene scene = new Scene(webView);
    primaryStage.setScene(scene);
    primaryStage.setMaximized(true);
    primaryStage.show();     
    **webEngine.load("http://localhost:3000");**
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source