Electron require modules: due to diffrent working directory while runtime intellisense is not working
up vote
0
down vote
favorite
Im writing an electron-app with vs-code. First I had some problems with requiring local files as modules, but i managed to fix them. The only problem now ist that i've lost intellisens for these local modules.
Project structure:
+---app
| | config.json
| | index.html
| |
| +---css
| | style.css
| |
| +---js
| config.js
| render.js
|
| main.js
| package.json
| README.md
My goal: use the methods from config.js in render.js.
I realize by now why vs-code behaves like it does but I dont see any solution: when the application is running the current working direcotry(__dirname) is ./app so i have to require the config.js-file over require(./js/config). The downside ist i lose complete intellisense for this module.
When im developing and have the render.js file open the current directory from vs-code's point of view is ./app/js, so the relativ path to my module is ./config.js. Now i would have intellisense again but the application is not working anymore:
require(./config) results in error: cannot find module
Is there any way that the application runs and i get intellisense in vs-code? I am grateful for any help I can get.
javascript node.js visual-studio-code electron intellisense
add a comment |
up vote
0
down vote
favorite
Im writing an electron-app with vs-code. First I had some problems with requiring local files as modules, but i managed to fix them. The only problem now ist that i've lost intellisens for these local modules.
Project structure:
+---app
| | config.json
| | index.html
| |
| +---css
| | style.css
| |
| +---js
| config.js
| render.js
|
| main.js
| package.json
| README.md
My goal: use the methods from config.js in render.js.
I realize by now why vs-code behaves like it does but I dont see any solution: when the application is running the current working direcotry(__dirname) is ./app so i have to require the config.js-file over require(./js/config). The downside ist i lose complete intellisense for this module.
When im developing and have the render.js file open the current directory from vs-code's point of view is ./app/js, so the relativ path to my module is ./config.js. Now i would have intellisense again but the application is not working anymore:
require(./config) results in error: cannot find module
Is there any way that the application runs and i get intellisense in vs-code? I am grateful for any help I can get.
javascript node.js visual-studio-code electron intellisense
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Im writing an electron-app with vs-code. First I had some problems with requiring local files as modules, but i managed to fix them. The only problem now ist that i've lost intellisens for these local modules.
Project structure:
+---app
| | config.json
| | index.html
| |
| +---css
| | style.css
| |
| +---js
| config.js
| render.js
|
| main.js
| package.json
| README.md
My goal: use the methods from config.js in render.js.
I realize by now why vs-code behaves like it does but I dont see any solution: when the application is running the current working direcotry(__dirname) is ./app so i have to require the config.js-file over require(./js/config). The downside ist i lose complete intellisense for this module.
When im developing and have the render.js file open the current directory from vs-code's point of view is ./app/js, so the relativ path to my module is ./config.js. Now i would have intellisense again but the application is not working anymore:
require(./config) results in error: cannot find module
Is there any way that the application runs and i get intellisense in vs-code? I am grateful for any help I can get.
javascript node.js visual-studio-code electron intellisense
Im writing an electron-app with vs-code. First I had some problems with requiring local files as modules, but i managed to fix them. The only problem now ist that i've lost intellisens for these local modules.
Project structure:
+---app
| | config.json
| | index.html
| |
| +---css
| | style.css
| |
| +---js
| config.js
| render.js
|
| main.js
| package.json
| README.md
My goal: use the methods from config.js in render.js.
I realize by now why vs-code behaves like it does but I dont see any solution: when the application is running the current working direcotry(__dirname) is ./app so i have to require the config.js-file over require(./js/config). The downside ist i lose complete intellisense for this module.
When im developing and have the render.js file open the current directory from vs-code's point of view is ./app/js, so the relativ path to my module is ./config.js. Now i would have intellisense again but the application is not working anymore:
require(./config) results in error: cannot find module
Is there any way that the application runs and i get intellisense in vs-code? I am grateful for any help I can get.
javascript node.js visual-studio-code electron intellisense
javascript node.js visual-studio-code electron intellisense
asked Nov 9 at 14:01
saftimufti
364
364
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
I found the problem.. I was referencing the render.js in the index.html file. If I load it with require(./app/js/render) in the app.js file everything works fine, including intellisens.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
I found the problem.. I was referencing the render.js in the index.html file. If I load it with require(./app/js/render) in the app.js file everything works fine, including intellisens.
add a comment |
up vote
0
down vote
accepted
I found the problem.. I was referencing the render.js in the index.html file. If I load it with require(./app/js/render) in the app.js file everything works fine, including intellisens.
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
I found the problem.. I was referencing the render.js in the index.html file. If I load it with require(./app/js/render) in the app.js file everything works fine, including intellisens.
I found the problem.. I was referencing the render.js in the index.html file. If I load it with require(./app/js/render) in the app.js file everything works fine, including intellisens.
answered Nov 9 at 14:59
saftimufti
364
364
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53227152%2felectron-require-modules-due-to-diffrent-working-directory-while-runtime-intell%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown