faisalman / ua-parser-js

"Unmask Your Traffic" - UAParser.js: The Essential Web Development Tool for User-Agent Detection
https://uaparser.dev/
GNU Affero General Public License v3.0
9.28k stars 1.2k forks source link

TypeError: ua_parser_js_1.default is not a constructor #670

Closed th3f0r3ign3r closed 1 year ago

th3f0r3ign3r commented 1 year ago

Tthe bug I just trying to parse the userAgent of users calling an API based on NestJS and after creating an instance of UAParser and the userAgent i get this error when calling the function TypeError: ua_parser_js_1.default is not a constructor

After installing nestjs

app.controller.ts

CleanShot 2023-09-23 at 09 00 45@2x

Result

CleanShot 2023-09-23 at 08 55 07@2x

OS: MacOs 13.5.2

faisalman commented 1 year ago

UAParser is exposed as a named export rather than a default, maybe you miss the {}?

import { UAParser } from 'ua-parser-js'
th3f0r3ign3r commented 1 year ago

UAParser is exposed as a named export rather than a default, maybe you miss the {}?

import { UAParser } from 'ua-parser-js'

OK let me try !🤞🏾

th3f0r3ign3r commented 1 year ago

UAParser is exposed as a named export rather than a default, maybe you miss the {}?

import { UAParser } from 'ua-parser-js'

Thanks it work !!