I'm discovering Electron and I'm facing a problem: I can't implement my "common.js" file in my "test.js" script.
Here is the architecture of my project:
rootProject
   -features(folder)
      -common.js
      -test.js
   -index.html
common.js
const hello = "hello";
module.exports = { hello };
test.js
const {hello} = require("./common.js");
console.log(hello);
index.html
<body>
  <h1>Hello World!</h1>
  <div class="flex-container">
    <span id="timeAfterRefreshGasFees"></span>
    <span id="rapid"></span>
    <span id="fast"></span>
    <span id="standard"></span>
    <span id="slow"></span>
  </div>
  <!-- You can also require other files to run in this process -->
  <script src="./renderer.js"></script>
  <!-- <script src="./features/common.js"></script> -->
  <script src="./features/test.js"></script>
</body>
In this case, I got: Error: Cannot find module './common.js'
And if I uncomment <script in index.html, I got this error: Identifier 'hello' has already been declared
I want to have a common.js file where I can put stuff inside (like const etc...)
How can I fix it?
I already tried all these solution: Getting Unexpected Token Export
Thank you!
EDIT after first solution:
I added these lines to get nodeIntegration
webPreferences: {
  nodeIntegration: true,
  contextIsolation: false,
  preload: path.join(__dirname, 'preload.js')
}
And removed <script in common.js
<script  src="./features/common.js"></script>
But now, I have this error when I'm trying to require in test.js: Cannot find module './common.js'
 
     
    