I don't get the logic of the module conception in nodejs / javascript
Here is my file : circle.js
const circleArea = r => 3.14 * (r ** 2);
const squareArea = s => s * s;
export {circleArea, squareArea};
file testCircle.js
import { circleArea as circle, squareArea } from "./circle.js"
console.log(squareArea(2));
When I run the program node testCircle.js
SyntaxError: Cannot use import statement outside a module
I have found an explanation here :
SyntaxError: Cannot use import statement outside a module
So In have updated my package.json
"type": "module"
And it works
BUT
then when I want to run another file which require :
const http = require("http");
I got this new error :
ReferenceError: require is not defined
Is there a way to work with both import and require ?