Skip to content

Commit 1e5d368

Browse files
authored
fix(security/helmet): change helmet import hint
1 parent 81848bc commit 1e5d368

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/security/helmet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ $ npm i --save helmet
1515
Once the installation is complete, apply it as a global middleware.
1616

1717
```typescript
18-
import helmet from 'helmet';
18+
import * as helmet from 'helmet';
1919
// somewhere in your initialization file
2020
app.use(helmet());
2121
```
2222

23-
> info **Hint** If you are getting a error (`TypeError: helmet_1.default is not a function`) while trying to import Helmet, you will need to set `allowSyntheticDefaultImports` and `esModuleInterop` to `true` in your project's `tsconfig.json`. Another solution is to import `Helmet` using `import * as helmet from 'helmet'`.
23+
> info **Hint** If you are getting a error (`This expression is not callable`) while trying to import Helmet, you probably have `allowSyntheticDefaultImports` and `esModuleInterop` set to `true` in your project's `tsconfig.json`. If this is the case, you will need to use `import helmet from 'helmet'`, instead of the example.
2424
2525
#### Use with Fastify
2626

0 commit comments

Comments
 (0)