For mobile development, it would be great if we can specify optionally globally or per project a fixed port for the preview and not a random port assigned each time we relaunch Wappler.
Usually I have Chrome or Firefox opened and setup for development (e.g. device emulator set, chrome debugger opened, application or element views configured.
With every launch of Wappler (and wappler crashes from time to time), I have to either manually change the port into a open window or setup a new debug view.
With a fixed port, I can use bookmarks and makros to open my debug views as expected
Bumping as this is a constant challenge. Restarting Wappler, changing from Stable to Beta, or working on more than two projects all cause the Capacitor project’s web server port to change, requiring updating the Server’s CORS and pushing to the cloud target I’m using.
As a workaround you can modify the first serverPort variable in server.js from 0 to another port number (e.g. 59540) located in <install directory>\Wappler\resources\app\Shared\DMXzone\dmxAppCreator\UI\server.js
I’m not sure what issues this will cause if you’re working on multiple projects and switching between them, but it appears to work between one Server project and Capacitor mobile project.
Bump please, it would be a really nice feature cause we are unabled to run a mobile preview.
Thinking loud here, It needs to auto update cors too, cause that’s the point, since the problem is the localhost port.
Changing port => changing port on cors too.
Sounds difficult for the team?
Bumping this. It’s super important for mobile development.
Maybe you can fix it on something like 9899 and we can change that port on Wappler options and not per project, so in that way we could add it easily on the backend project -> cors -> add mobile
Hey Keith, yes, I’m using the workaround, sadly I have to change it on every Wappler update.
But thanks for sharing this, is very helpfull for me!
I’m thinking more on new users, and someone who want to give it a try at mobile development.
The reality is that I love Wappler and we frecuentely see on this forum that mobile development with Wappler is “useless”.
I made a completely functional app with F7, and (besides things that are complex) things like these (priority) need some work from the team to reach that goal.
Actually that is why we have the QR code scan in the design view toolbar so you can just scan it with your mobile and the right link with port will be opened for preview on your mobile.
@George this is not about preview on a mobile device.
This is a problem of cors.
Open the Mobile project and the preview is on localhost:123
(So you’ll have a problem of cors because it’s not localhost. It’s localhost:123)
Open Backend project and add cors: localhost:123
Open Mobile project and the localhost is now localhost:456, so you’re unable to communicate to backend.
It’s an infinite loop and unable to solve it via Wappler.
Most of the time, before building/packing the app into android/electron, it’s easier to develop the mobile app in the web browser. As you switch between multiple projects, restart Wappler to troubleshoot issues between beta and stable channel, when Wappler crashes, or other events, the port changes.
When using CORS on the server project this is a continual challenge that requires updating CORS entries many times in a day to be able to test the mobile project. It’s an extremely frustrating occurrence and something that seems like an easy fix.
It seems like the quickest fix would be for you to set a port number instead of 0 in this file (e.g. 1024-49151) so when we install Wappler we don’t have to deal with this issue. Even better, would be to allow us to set this via the project options page.
Unless we edit server.js file from the app folder we’re unable to test a desktop/mobile project on a browser.
It’s a shame that the only way is building and using an emulator, not sense at all.