faisalman / ua-parser-js

UAParser.js - The Essential Web Development Tool for User-Agent Detection.

Home Page:https://uaparser.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: ua_parser_js_1.default is not a constructor

th3f0r3ign3r opened this issue · comments

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

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

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

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 !🤞🏾

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

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

Thanks it work !!