Reputation: 1638
I'm building an Electron application. It uses jquery to do some things.
I insert jquery with this in my index page:
<script>
window.$ = window.jQuery = require('jquery');
</script>
And jquery is stored in /node_modules/jquery.js
.
This works fine when i run the app local or on an network drive. But if i run it on the local network it can't find the module jquery.
So:
X:\app\Electron.exe
can load jquery, while
\\servername\share\app\Electron.exe
can't.
I've to use a relative path, because the app can be runned from different locations.
I did try to use other relative paths.
Upvotes: 1
Views: 776
Reputation: 10001
Create a batch file with:
pushd \\server\share\
your-electron-program.exe
popd
This will dynamically create a mapped drive and get rid of it once the program ends.
If you don't like having a .bat
file and the command window, buy Batch Compiler and compile it into an Exe. Or other similar program.
Upvotes: 0
Reputation: 1638
I haven't found a solution! But I do have a workaround.
I compressed the hole project with WinRar:
Select all files -> Add to archive
Archive name -> Name of your Electron application.
Archiving options -> Create SFX archive
Now go to "Advanced" tab -> SFX Options
Run after extraction -> electron.exe (or if you renamed it, that name)
Go to "Modes" tab -> Unpack to temporary folder
Silent mode -> Hide all
Ok -> Ok
Now you get one .exe file. What happens if you run it from any place:
So you never get the problem, because it's local.
But i think it will cost some performance...?
Upvotes: 0