Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building project after Updating fasitfy-helmet to latest version 5.0.1 #94

Closed
gp187 opened this issue Sep 14, 2020 · 5 comments · Fixed by #95
Closed

Error building project after Updating fasitfy-helmet to latest version 5.0.1 #94

gp187 opened this issue Sep 14, 2020 · 5 comments · Fixed by #95

Comments

@gp187
Copy link

gp187 commented Sep 14, 2020

🐛 Bug Report

Updating fasitfy-helmet to latest version 5.0.1

To Reproduce

Steps to reproduce the behavior:

  // -->Register: security policy and plugins
  fastify.register(require('fastify-helmet'), {
    hidePoweredBy: {
      setTo: 'PHP 7.4.0'
    }
  });

Expected behavior

Throws this error

node_modules/fastify-helmet/index.d.ts:2:8 - error TS1259: Module '"/lab/naologic-apps/bee11/node_modules/helmet/dist/index"' can only be default-imported using the 'esModuleInterop' flag

2 import helmet from "helmet";
         ~~~~~~

  node_modules/helmet/dist/index.d.ts:44:1
    44 export = helmet;
       ~~~~~~~~~~~~~~~~
    This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.

Cannot just enable esModuleInterop because it will trigger errors in many other modules.

Your Environment

  • node version: 12
  • fastify version: 3.4.0
  • os: Linux
@mcollina
Copy link
Member

What version of fastify-plugin have you got in your tree? Can you please include a full example (maybe a repo) to reproduce? thanks

@fox1t
Copy link
Member

fox1t commented Sep 14, 2020

As far as I can see this is not an error. We still use old export here (not the "infamous triplet"). You have 4 options: set the skipLibCheck to true; set esModuleIntrop to true; import using import * as helmet from; send a PR to fix the exports :)

@mcollina
Copy link
Member

@fox1t we should have the infamous triplet here as well ;)

@fox1t
Copy link
Member

fox1t commented Sep 14, 2020

Yea, I agree. :)

@fox1t
Copy link
Member

fox1t commented Sep 14, 2020

I am going to fix this. There is a problem with how we import helmet types too.

Thanks for reporting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants