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
DeviceDetector is declared with export = DeviceDetector; and no default export is specified.
Our project was configured without 'allowSyntheticDefaultImports'.
With this configuration:
an IDE like webstorm will automatically import DeviceDetector with the line
import * as React from "react";
which will work fine in development, but when the project is built, there will be exceptions, the DeviceDetector constructor will not be found.
Trying to import DeviceDetector with this configuration like this
import DeviceDetector from "device-detector-js";
leads to the following typescript error:
⚠️ Missing/incorrect detections should be reported at https://github.com/matomo-org/device-detector/issues instead of this repo.
TS1259: Module '"C:/dev/viuport/client/node_modules/device-detector-js/dist/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag index.d.ts(34, 1): This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.
DeviceDetector is declared with
export = DeviceDetector;
and no default export is specified.Our project was configured without 'allowSyntheticDefaultImports'.
With this configuration:
DeviceDetector
with the linewhich will work fine in development, but when the project is built, there will be exceptions, the
DeviceDetector
constructor will not be found.Trying to import
DeviceDetector
with this configuration like thisleads to the following typescript error:
TS1259: Module '"C:/dev/viuport/client/node_modules/device-detector-js/dist/index"' can only be default-imported using the 'allowSyntheticDefaultImports' flag index.d.ts(34, 1): This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.
see also https://www.typescriptlang.org/tsconfig#allowSyntheticDefaultImports
I would instead endorse exporting
DeviceDetector
as default, for example like thisThe text was updated successfully, but these errors were encountered: