Code Monkey home page Code Monkey logo

Comments (4)

Its-treason avatar Its-treason commented on May 24, 2024

This is the relevant code:

const url = isDev
? 'http://localhost:3000'
: format({
pathname: path.join(__dirname, '../web/index.html'),
protocol: 'file:',
slashes: true
});
mainWindow.loadURL(url).catch((reason) => {
console.error(`Error: Failed to load URL: "${url}" (Electron shows a blank screen because of this).`);
console.error('Original message:', reason);
if (isDev) {
console.error(
'Could not connect to Next.Js dev server, is it running?' +
' Start the dev server using "npm run dev:web" and restart electron'
);
} else {
console.error(
'If you are using an official production build: the above error is most likely a bug! ' +
' Please report this under: https://github.com/usebruno/bruno/issues'
);
}
});

When starting in dev mode, Bruno tries to open http://localhost:3000. When run in production mode, Bruno opens the JavaScript bundle included in the app.

If you try to run Bruno from source, make sure to run npm run dev:web before starting electron.

from bruno.

PeterBenko avatar PeterBenko commented on May 24, 2024

Nice, straight to the point!
However, I would postulate that isDev isn't the right tool for this use case and should actually be app.isPackaged.
In the recent times when developing an Electron app - and having ELECTRON_IS_DEV permanently turned on - I leaned to expect many other apps opening the dev tools, which I understand - it basically flips them into debug mode. However, none of them straight up broke like Bruno did.
The decision to use the dev-server served content isn't something that should be based on the debug flag. I'd say it should either be a run argument (like --useDevServer) or the above mentioned app.isPackaged check. Is Bruno ever expected to run not packaged in production?

I'm open to creating a PR for either of the fixes :)

from bruno.

Its-treason avatar Its-treason commented on May 24, 2024

Yeah, you're right, app.isPackaged would totally be the better option here. You can create a PR for this, if you want, we would appreciate it.

from bruno.

PeterBenko avatar PeterBenko commented on May 24, 2024

#1260 is open :)

from bruno.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.