-
Notifications
You must be signed in to change notification settings - Fork 112
Open
Description
When working with ESM, then using the following example code does not work anymore with v2.0.1:
import express from 'express';
import useragent from 'express-useragent';
const app = express();
app.use(useragent.express());The default export does not have a function called express().
What does work is the following:
import express from 'express';
import * as useragent from 'express-useragent';
const app = express();
app.use(useragent.express());You can also import the exported function itself, but that will collide with the express-import, so you have to rename:
import express from 'express';
import { express as mw } from 'express-useragent';
const app = express();
app.use(mw());You may want to update your documentation here. The example still works for CommonJS code using require().
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels