Home > Blockchain >  what are ".js.map" files?
what are ".js.map" files?

Time:02-12

I cloned a repo with a build command that runs webpack and it generates an index.js and index.map.js file. I assume index.js is a minified version of all the code, but what is index.map.js?

CodePudding user response:

The config devtool: 'source-map' in webpack.config.js generated this file when you built it.

Why it is needed?

You can run minified Javascript or transpiled Javascript which is good for performance, but not particularly helpful when debugging. Source maps are a way for modern browsers to take the minified code (js, css) and allow us to read the code in its unminified state in the debugger.

Further reading,

CodePudding user response:

You have devtool: 'source-map' in the webpack.config.js file.

.map files are sourcemaps for debugging purposes. I suggest you read what a source map is.

  • Related