Remove dock icon mac without effecting other OS's


So when running my app from the terminal using electron command my app works fine but when I then package the application up on a mac it does not seem to find the html file and nothing is shown. Is there something I need to do with the paths to files? Right now it’s mainWindow.loadURL(file://${__dirname}/index.html)

EDIT: In the packaged version, if I remove the code app.dock.hide(); it works fine so this is causing problems. How do I hide the dock icon on mac but without conflicting with other OS’s and for it to work in the packaged version?