#[ERROR] Failed to resolve entry for package "fs" during pre-bundling

1 messages · Page 1 of 1 (latest)

warped chasm
#

I'm getting an error when trying to add another dev dependency ("mailinator-client" if its relevant) and running vite in dev mode.

 This error came from the "onResolve" callback registered here:

    ../../node_modules/esbuild/lib/main.js:1279:20:
      1279 │       let promise = setup({
 The plugin "vite:dep-pre-bundle" was triggered by this import

    ../../node_modules/request/lib/har.js:3:17:
      3 │ var fs = require('fs')```

The error 100% comes from adding mailnator client.
I'm trying to use mailnator-client for playwright, hence it being in dev dependencies, is there any way to make vite ignore it?
Anybody ever encounter something like this?
#

https://pastebin.com/DCY7jem9 is the full error message

Also this is in a turborepo monorepo and for some reason when I have this dev dependency in one app it breaks all of the apps

Mailnators dependencies are:

"dependencies": {
    "@types/node": "^13.1.8",
    "create-index": "^2.6.0",
    "fs": "0.0.1-security",
    "typed-rest-client": "^1.7.1"
  },

so it also declares fs

bold wren
#

I have had "kind of" similar problem:
https://discord.com/channels/804011606160703521/1109727725238894663

But, as I see, "mailinator-client" already includes @types/node, so really IDK what exactly is happening with your project. Maybe, "mailinator-client" is poorly maintained -- only 9 stars on github.

At least it might fuel your further investigations, for example, maybe try to create simple test project with TypeScript (I presume you are using it), add import or require from fs, see if it's working, then add those dependencies one after another

    "@types/node": "^13.1.8",
    "create-index": "^2.6.0",
    "fs": "0.0.1-security",
    "typed-rest-client": "^1.7.1"
  },```
and see at which step the app will break. This might lead you to some ideas.