sindresorhus / file-type

Detect the file type of a file, stream, or data
MIT License
3.64k stars 345 forks source link

Got this build error: Could not resolve "node:buffer" #614

Closed dinghaoz closed 10 months ago

dinghaoz commented 10 months ago

✘ [ERROR] Could not resolve "node:buffer"

node_modules/file-type/core.js:1:21:
  1 │ import {Buffer} from 'node:buffer';
    ╵                      ~~~~~~~~~~~~~

The package "node:buffer" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

I am using node.js

sindresorhus commented 10 months ago

This is a problem with your bundler config.