Skip to content

Commit

Permalink
fix: esm import formidable
Browse files Browse the repository at this point in the history
  • Loading branch information
climba03003 committed Oct 21, 2022
1 parent e022402 commit e24209a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { FastifyPluginAsync, FastifyRequest } from 'fastify'
import FastifyPlugin from 'fastify-plugin'
import type { Fields, File, Files, Options } from 'formidable'
import { IncomingForm } from 'formidable'
// Since, formidable is CommonJS module
// It's exportation do not match the syntax of ESM named export
// We need to use namespace and property export in this case
import FormidableNamespace from 'formidable'
import type Formidable from 'formidable/Formidable'
import * as fs from 'fs'
import { IncomingMessage } from 'http'
export const kIsMultipart = Symbol.for('[FastifyMultipart.isMultipart]')
export const kIsMultipartParsed = Symbol.for('[FastifyMultipart.isMultipartParsed]')
export const kFileSavedPaths = Symbol.for('[FastifyMultipart.fileSavedPaths]')
const { IncomingForm } = FormidableNamespace

declare module 'fastify' {
interface FastifyRequest {
Expand Down

0 comments on commit e24209a

Please sign in to comment.