Ask for an advice in folder structure with external JS files
See original GitHub issue- Version: 7.14.2
- Target: MacOS, Windows
Please take a look at the folder structures below:
Development folder structure (after compiled from src
)
▾ app/
▸ node_modules/
▸ out/
▸ workers/
package.json
Build folder structure
▾ app.asar/
▸ node_modules/
▸ out/
package.json
▾ app/
▸ workers/
I’m trying to find a good way to work with external files. Due to our project’s needs, we have to fork some processes from workers
folder. I used extraResouces
to get rid of worker
folder and I got a problem since the path of worker
folder is changed in the build. For instance, if I want to require blahblah-modules
, I have to declare the path differently for each environment: blahblah-modules
(development) and ../../app.asar/node_modules/blahblah-modules
(build). I would like to ask for an advice to improve this silly path.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Finding my Javascript file that is in another folder
To import a JS file it most be in a static folder. ... Folder structure should have a static folder and should look...
Read more >Use external js file or controller? - Hotwire Discussion
Hi I want to create a class just to call in other controller. Now which is better? 1 - create a extra folder...
Read more >5 Tips to Organize Your JavaScript Code Without a Framework
When you're organizing JavaScript code without a framework, there are some best practices you should follow to ensure a clean structure.
Read more >Handling common JavaScript problems - MDN Web Docs
Incorrectly using functions inside loops that iterate with a global variable (more generally "getting the scope wrong"). For example, in bad-for ...
Read more >External JavaScript File - Javatpoint
An external JavaScript file must be saved by .js extension. It is recommended to embed all JavaScript files into a single file. It...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@develar That’s surprising when I tried to make a sample app. I can fork the worker with the path like
electron-sample.app/Contents/Resources/app.asar/workers/text-generator
. Regarding this I never thought that it could work. So I don’t need any workaround so far.Probably, if you can provide sample app, I will try find free time to play with it and simplify somehow.
Maybe, electron supports this search path if your worker will use
asar.unpack
. I am sorry, but without sample app I will not investigate it further.