How to import library?
pqr opened this issue · 1 comments
pqr commented
How to import the library into my typescript code?
- When I write
import DeviceDetector from 'device-detector-js';
I get an error "no default export".
- When I try
import * as DeviceDetector from 'device-detector-js';
It also shows an error and does not work.
- Third attempt:
import { DeviceDetector } from 'device-detector-js';
Error: there is no exported member "DeviceDetector"
Example in README.md shows require syntax, but I want to use ES6 modules syntax.
Could you please and an example with ES6 modules syntax into README.md?
etienne-martin commented
Hi there,
You need to use the CommonJS-style import syntax to use this module with typescript:
import DeviceDetector = require("device-detector-js");
I will update the README with instruction on how to use this module with typescript.
Thanks for the feedback.