Different packages importing method

So i use javascript
Discord.js requires a require() importing method
polarity requires a import … from … method

if i remove “type”: “module”, from the config.json file,
polarity will have the error “SyntaxError: Cannot use import statement outside a module”

but if i add it back,
Discord.js will have the error

 ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/home/runner/HopeHub20/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.

how do i put these 2 together

Can you please send a Repl link?