Could not load content for webpack source file in Chrome sources tab
Asked Answered
C

3

20

I'm using webpack v4.16.2 as my bundle tool, and set devtool to 'source-map'. I'm trying to debug the source file through the Chrome sources tab. However, when I click the source file lie down webpack:// directory, an error occurred:

enter image description here

I'm not using webpack-dev-server, just build the source files into the dist/ folder, and load the page through Nginx.

What does this error mean? I'm pretty sure that the source map files are generated. How can I fix this?

Thanks in advance.

Craniometry answered 24/2, 2020 at 4:52 Comment(1)
were you able to figure this out?Fraser
R
4

Alex is right,

source-map devtool mode generate .map file when minify the code in production mode, file lost sourcesContent property.

Another way to fix it is to uncheck the Enable JavaScript source maps in Chrome Dev Tool. screenshot of Chrome Dev Tool settings

Ruche answered 10/11, 2022 at 10:1 Comment(0)
C
0

I have been the same issue this whole day:

try set webpack.prod.config

  optimization: {
    minimize: false
  }

Here is what I found so far:

source-map devtool mode generate .map file lost sourcesContent property when minify the code which is default in production mode. And the 'webpack://XXXX' to locate the sourcesContent where the original code is, then the error happens.

Chibcha answered 11/3, 2020 at 9:52 Comment(0)
S
0

I was getting exactly the same problem, same error message etc when trying to debug typescript / html in Google Chrome.

The solution is to empty your cache.

Press Control + H to load up your browser history, and press the Clear Data button.

The try pressing Control + O or Control + P to load/select a source file again.

enter image description here

Skater answered 28/1, 2021 at 8:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.