Skip to content

Missed dependency file-type #1446

@mirismaili

Description

@mirismaili

What version of Elysia is running?

1.4.8

What platform is your computer?

node:24.8.0-alpine (Docker image)

What environment are you using

Node.js 24.8.0

Are you using dynamic mode?

No

What steps can reproduce the bug?

After I upgrading Elysia from v1.4.5 to v1.4.8 I encountered this error on CI pipeline:

  Rsbuild v1.5.9

info    build started...
error   Build error:
File: javascript/esm|/app/node_modules/elysia/dist/index.mjs:1:1
  × Module not found: Can't resolve 'file-type' in '/app/node_modules/elysia/dist'
      ╭─[1441:30]
 1439 │     "[Elysia] Attempt to validate file type without 'file-type'. This may lead to security risks. We recommend installing 'file-type' to properly validate file extension."
 1440 │   ), _fileTypeFromBlobWarn = !0);
 1441 │ }, loadFileType = async () => import("file-type").then((x) => (_fileTypeFromBlob = x.fileTypeFromBlob, _fileTypeFromBlob)).catch(warnIfFileTypeIsNotInstalled), _fileTypeFromBlob, fileTypeFromBlob = (file2) => _fileTypeFromBlob ? _fileTypeFromBlob(file2) : loadFileType().then((mod) => {
      ·                               ───────────────────
 1442 │   if (mod) return mod(file2);
 1443 │ }), fileType = async (file2, extension, name = file2?.name ?? "") => {
      ╰────

I installed file-type and the issue fixed. Is it correctly listed in devDependencies?

What is the expected behavior?

The project should build w/o need to install file-type.

What do you see instead?

No response

Additional information

No response

Have you try removing the node_modules and bun.lockb and try again yet?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions