neeraj jangid
neeraj jangid

Reputation: 75

How can I debug webpack bundle file error and find exact error in bundle that consists thousand no. of lines in reactJs

I want to find exact error in my program, where is error occurring in real time. I have been facing problem to detect error as It only shows bundle file that have thousand no. of lines. That is next to impossible to go through all the code at once. Please provide solution If you have. Thanks in advance...

Upvotes: 5

Views: 4539

Answers (3)

PestoP
PestoP

Reputation: 299

Where you call webpack function, you can console.log the stats :

webpack(config, function (err, stats) {
  if (err) {
    console.log(err)
  }
  console.log(stats.toString())
})

Maybe it could help you

Upvotes: 0

Abdennour TOUMI
Abdennour TOUMI

Reputation: 93531

In webpack config file , check debug is true :

{
    debug: true,
    devtool: 'source-map',
    entry: ...

....
}

Upvotes: 0

SatyaDash
SatyaDash

Reputation: 190

Please use the devtool option of webpack.

Look at it https://webpack.github.io/docs/configuration.html#devtool

I suggest use eval like below

devtool: debug ? "eval" : null,

It will minimize your code and show you where the error is actually.For more info refer the link i have shared.

Upvotes: 0

Related Questions