Must use import to load ES Module: C:\Projects\projects\projects\node_modules\gifsicle\index.js
require() of ES modules is not supported.
require() of C:\Projects\projects\projects\node_modules\gifsicle\index.js from C:\Projects\projects\projects\file.ts is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\Projects\projects\projects\node_modules\gifsicle\package.json.
I also tried renaming the files but it not worked. Removing the type: module from package.json also throws errors.
When I try to install this module, I will get an error while I try to use it.
I am using Typescript along with Node.js v14.17.5.
This is my example code:
When I run this, I get this error:
I also tried renaming the files but it not worked. Removing the type: module from package.json also throws errors.
Any thoughts?