Reputation: 1721
Why on earth can I not move my main.js file into a sub directory and have electron build from the that sub directory? for instance my file structure:
app
|_package.json
|_node_modules
|_src
|_main.js
|_index.html
|_renderer.js
|_...
My package.json:
"main":"main.js",
"scripts" : {
"start": "electron ./src"
}
When I run start electron launches the intro screen("to start your application run ...") and not the application I created at ./src. Is there a package out there that allows for this to happen? is there something I'm missing in the package.json file?
Been a while since I posted to SO but this one got me stumped / its not clearly documented on Electron's site(you'd think it would be in architecture). I do see in the quickstart about file structure but it doesn't say I can't do as I illustrated above^ It's not really a big deal I just hate when Im forced into a specific file structure.
Upvotes: 10
Views: 3185
Reputation:
The Electron application I am developing makes also use of a main.js
file located in a sub-directory, and this is how it would be documented in your package.json
file:
"main":"src/main.js",
"scripts" : {
"start": "electron ."
}
I guess this is because npm
needs the correct relative path of the startup script in package.json
...
There may be also some relevant information in Writing Your First Electron App.
Upvotes: 10