fastify / fastify-helmet

Important security headers for Fastify
Other
405 stars 46 forks source link

Bundling ESM project with this package is not working #239

Closed a7md0 closed 10 months ago

a7md0 commented 10 months ago

Prerequisites

Fastify version

4.24.3

Plugin version

11.1.1

Node.js version

20.4

Operating system

Windows

Operating system version (i.e. 20.04, 11.3, 10)

11

Description

While including this package in an ESM project that esbuild bundler is used it will throw error on runtime Error: Dynamic require of "node:crypto" is not supported

Steps to Reproduce

  1. Setup new Fastify project
  2. Add esbuild and output ESM (it will work until this step)
  3. Add this plguin npm i @fastify/helmet and use it
  4. Build using esbuild again (it will fail at runtime on this stage)

Expected Behavior

This package should provide ESM version as well so bundlers like esbuild will work with it

Uzlopak commented 10 months ago

Provide a proof, that this is an issue of fastify/helmet and not an issue with upstream helmet or esbuild.