saltyshiomix / nextron

⚡ Next.js + Electron ⚡
https://npm.im/nextron
MIT License
3.7k stars 215 forks source link

Run localhost in production mode #336

Open Charles808 opened 1 year ago

Charles808 commented 1 year ago

Using nextron default example, the dev app will be run on localhost, while the production will be run on "app://.index.html"

My problem is, I'm using Salesforce REST API, which only able to whitelist application using HTTPS or HTTP (only for localhost) url. Therefore, nextron app is working on dev but failed at production app because the origin is changed.

Is it possible to configure my nextron app, so at production build, it also using localhost ?

azwalzaman commented 1 year ago

I need this as well for similar reasons

madaghafuri commented 11 months ago

I need it for handling another window with dynamic route in production. Or is it already possible and if it is do have any resource on it?

d-mashchenko commented 9 months ago

It's also necessary, maybe someone knows a workaround. In production mode google api prohibits url like: "app://.index.html"

bm777 commented 7 months ago

@Charles808 @azwalzaman @madaghafuri @d-mashchenko The best workaround is to use a single static file (index.html) with a combined components game, just to have a good orchestration of components on a single page.

pixelass commented 2 months ago

We allow running static pages as extensions of our app. These might also require https (or localhost), for certain Web APIs like mediaSources, so what we do is to just use electron serve with a separate protocol per app/extesnion and set the host to "localhost". Works like a charm: https://github.com/blib-la/captain/blob/f5d79534f0424198562f320a13a310ce7a08c460/src/electron/helpers/app-loaders.ts#L79-L125

specifically this part: https://github.com/blib-la/captain/blob/f5d79534f0424198562f320a13a310ce7a08c460/src/electron/helpers/app-loaders.ts#L117-L122