简体   繁体   中英

what are ".js.map" files?

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 ?

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,

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM