Fail to import component from subwindow, when nativeWindowOpen is true


#1

What I want to do
Folder structure is pasted to next comment

I want to import component.js from subwindow.js like below
1.main.js: loadUrl(mainwindow/index.html)
2.index.html: load mainwindow.js
3.mainwindow.js: window.open(…/subwindow/sub.html)
4.sub.html: load subwindow.js
5.subwindow.js require(…/component/component.js)

Also I want to use Chrome’s built-in window.open(). This means I want to set nativeWindowOpen option true.

Problem detail
This program fails to import component.js at step5

The path is different from actual folder structure, I think this may be the cause

__dirname is:
root/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/renderer

But I expect:
root/subwindow

Question
How can I import comonent.js from subwindow.js?
Off course, I can import like below
…/…/…/…/…/…/…/…/component/component.js
But this is too long…
If someone know any solution, could you help me?


#2

Folder structure of above question.

39