-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I m getting below error when trying to use const analytics = new Analytics('xxxxxx', 'xxxxxxxx'); ,i m using in main process by
import Analytics from 'electron-google-analytics4';
error log for reference
App threw an error during load
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\My Downloads\Project\node_modules\electron-google-analytics4\node_modules\axios\index.js
require() of ES modules is not supported.
require() of C:\My Downloads\Project\node_modules\electron-google-analytics4\node_modules\axios\index.js from C:\My Downloads\Project\node_modules\electron-google-analytics4\lib\index.js 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 C:\My Downloads\Project\node_modules\electron-google-analytics4\node_modules\axios\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\My Downloads\Project\node_modules\electron-google-analytics4\node_modules\axios\package.json.