Eomm / fastify-raw-body

Request raw body
MIT License
45 stars 10 forks source link

Seems empty when loaded from TypeScript #7

Closed mikemaccana closed 4 years ago

mikemaccana commented 4 years ago

🐛 Bug Report

This may be a bug, may be a help issue. I tried to ask on gitter but there's 0 rooms and 0 people.

I'm having trouble loading fastify-raw-body 2.0.0 via TypeScript's ES6 conversion.

To Reproduce

import * as fastifyRawBody from "fastify-raw-body";

app.register(fastifyRawBody, {
  global: false,
});

Would seem to be correct, but fastifyRawBody becomes {} and starting Fastify fails with:

/app/node_modules/avvio/boot.js:189
    throw new Error('plugin must be a function or a promise')
    ^

Expected behavior

logging fastifyRawBody should have some actual content.

You have already researched for similar issues?

I build a little CommonJS module and typescript parent to verify the above import syntax should work, and it does.

mikemaccana commented 4 years ago

Closing this, I worked out the fix, will contribute to docs