'Nodejs- requiring a module that uses "import"

I'm writing a nodejs project that processes images. I'm using a few different modules, one of them is bmp-ts. If i require it like in it's documentation:

const bmp = require('bmp-ts').default;

I receive an error

SyntaxError: Cannot use import statement outside a module

I cannot add type='module' to my package.json file, because other modules i'm using are used with 'require'. How can i use this module in my project, while keeping other modules?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source