You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const userAgent = new user_agents_1.default();
^
TypeError: user_agents_1.default is not a constructor
at Object.<anonymous> (C:\Users\user\Desktop\new\sdfsdf.js:4:19)
at Module._compile (internal/modules/cjs/loader.js:759:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:822:10)
at internal/main/run_main_module.js:17:11
code before compilation:
import UserAgent from 'user-agents';
const userAgent = new UserAgent();
console.log(userAgent.toString()); //
console.log(JSON.stringify(userAgent.data, null, 2));
I use typescript and get this error:
code before compilation:
code after compilation typescript:
I think it has something to do with: babel/babel#2212
I think this can be fixed using the plugin https://www.npmjs.com/package/babel-plugin-add-module-exports with a parameter
addDefaultProperty
The text was updated successfully, but these errors were encountered: