Webpack-cli: Can't resolve 'fs/promises'

Created on 4 Jun 2020  路  8Comments  路  Source: webpack/webpack-cli

I use the latest version of nodejs, typescript and webpack.

for this code:

import * from "fs/promises"

running tsc compiles the files without any problem, but with webpack I got the error
Module not found: Error: Can't resolve 'fs/promises'

Most helpful comment

@angelhdz

I AM THE ONE BEING TOXIC!?!? Ha ha haha! Arrogant people always reflect on others and they love the word toxic only when they say it to others, but they never stop to think "wait, what If I am being toxic?"

I haven't told you a single harsh word, only ask about example of problem.

Bah. I rarely have to deal with people like you. Fortunately, there are more kind people in these places, so I will ignore you.
And thanks to other kind people (not like you), I found the solution to my issue and also contributed (I think?) to the original poster.

You have the right to do what you want.

Even more, you did not open this problem, did not provide any information, only shame me. How can I know your environment?

We ask developers to use the issue template to avoid unnecessary questions and help as quickly as possible. I apologize if I cannot help you.

All 8 comments

It looks like you just deleted our lovely crafted issue template. It was there for good reasons. Please help us solving your issue by answering the questions asked in this template. I'm closing this. Please either update the issue with the template and reopen, or open a new issue.

Please read documentation https://webpack.js.org/configuration/node/

Uuugh I'm having this issue too. I started learning Electron with TypeScript and Vue 3, and everthing works, except for this issue trying to uses the fs module with the promises module to have the async readFile... I've been reading a looot of pages about webpack, trying different things, and nothing solves it!!!

You feedback is not help, please provide example how we can reproduce it

You feedback is not help, please provide example how we can reproduce it

Are you a bot, or an arrogant person? My feedback is important because I'm a user of this technology, and it did not work.

Or do you want me to open a new Issue and then hit me with the "this is a duplicate of..."???

_If you don't have anything good to say, better don't say anything because what you just said is not help either._

I use the latest version of nodejs, typescript and webpack.

for this code:

import * from "fs/promises"

running tsc compiles the files without any problem, but with webpack I got the error
Module not found: Error: Can't resolve 'fs/promises'

I solved this.

  1. If you are using Electron and you want to use fs module in the renderer, add this object to the BrowserWindow instance settings:
new BrowserWindow({
        webPreferences: 
        {
            nodeIntegration: true
        }
    });
  1. If your issue is not related to frontend, then use the current way of importing fs module:

    import { promises as fs } from "fs";
    
    await fs.readFile()
    

If you don't have anything good to say, better don't say anything because what you just said is not help either.

Don't be toxic, we ask you to create an example problem for a reason

It was fixed in webpack v5 (promises) without as, if you provide more information I can look

If you don't have anything good to say, better don't say anything because what you just said is not help either.

Don't be toxic, we ask you to create an example problem for a reason

It was fixed in webpack v5 (promises) without as, if you provide more information I can look

I AM THE ONE BEING TOXIC!?!? Ha ha haha! Arrogant people always reflect on others and they love the word toxic only when they say it to others, but they never stop to think "wait, what If I am being toxic?"

Bah. I rarely have to deal with people like you. Fortunately, there are more kind people in these places, so I will ignore you.

And thanks to other kind people (not like you), I found the solution to my issue and also contributed (I think?) to the original poster.

Thanks for nothing! https://github.com/alexander-akait

@angelhdz

I AM THE ONE BEING TOXIC!?!? Ha ha haha! Arrogant people always reflect on others and they love the word toxic only when they say it to others, but they never stop to think "wait, what If I am being toxic?"

I haven't told you a single harsh word, only ask about example of problem.

Bah. I rarely have to deal with people like you. Fortunately, there are more kind people in these places, so I will ignore you.
And thanks to other kind people (not like you), I found the solution to my issue and also contributed (I think?) to the original poster.

You have the right to do what you want.

Even more, you did not open this problem, did not provide any information, only shame me. How can I know your environment?

We ask developers to use the issue template to avoid unnecessary questions and help as quickly as possible. I apologize if I cannot help you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

evenstensberg picture evenstensberg  路  5Comments

billyjanitsch picture billyjanitsch  路  3Comments

RobotnickIsrael picture RobotnickIsrael  路  5Comments

r00nscapenab picture r00nscapenab  路  4Comments

sumukhah picture sumukhah  路  3Comments