UNPKG

3.31 kBMarkdownView Raw
1[![npm][npm]][npm-url]
2[![deps][deps]][deps-url]
3[![chat][chat]][chat-url]
4
5<div align="center">
6 <!-- replace with accurate logo e.g from https://worldvectorlogo.com/ -->
7 <a href="https://github.com/webpack/webpack">
8 <img width="200" height="200" vspace="" hspace="25"
9 src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg">
10 </a>
11 <h1>Sourcemap Loader</h1>
12 <p>Extracts source maps from existing source files (from their <code>sourceMappingURL</code>).<p>
13</div>
14
15<h2 align="center">Install</h2>
16
17```bash
18npm i -D source-map-loader
19```
20
21<h2 align="center">Usage</h2>
22
23[Documentation: Using loaders](https://webpack.js.org/concepts/#loaders)
24
25
26### Example webpack config
27
28``` javascript
29module.exports = {
30 module: {
31 rules: [
32 {
33 test: /\.js$/,
34 use: ["source-map-loader"],
35 enforce: "pre"
36 }
37 ]
38 }
39};
40```
41
42`source-map-loader` extracts existing source maps from all JavaScript entries. This includes both inline source maps as well as those linked via URL. All source map data is passed to webpack for processing as per a chosen [source map style](https://webpack.js.org/configuration/devtool/) specified by the `devtool` option in [webpack.config.js](https://webpack.js.org/configuration/).
43
44This loader is especially useful when using 3rd-party libraries having their own source maps. If not extracted and processed into the source map of the webpack bundle, browsers may misinterpret source map data. `source-map-loader` allows webpack to maintain source map data continuity across libraries so ease of debugging is preserved.
45
46`source-map-loader` will extract from any JavaScript file, including those in the `node_modules` directory. Be mindful in setting [include](https://webpack.js.org/configuration/module/#rule-include) and [exclude](https://webpack.js.org/configuration/module/#rule-exclude) rule conditions to maximize bundling performance.
47
48<h2 align="center">Maintainers</h2>
49
50<table>
51 <tbody>
52 <tr>
53 <td align="center">
54 <img width="150" height="150"
55 src="https://avatars3.githubusercontent.com/u/166921?v=3&s=150">
56 </br>
57 <a href="https://github.com/bebraw">Juho Vepsäläinen</a>
58 </td>
59 <td align="center">
60 <img width="150" height="150"
61 src="https://avatars2.githubusercontent.com/u/8420490?v=3&s=150">
62 </br>
63 <a href="https://github.com/d3viant0ne">Joshua Wiens</a>
64 </td>
65 <td align="center">
66 <img width="150" height="150"
67 src="https://avatars3.githubusercontent.com/u/533616?v=3&s=150">
68 </br>
69 <a href="https://github.com/SpaceK33z">Kees Kluskens</a>
70 </td>
71 <td align="center">
72 <img width="150" height="150"
73 src="https://avatars3.githubusercontent.com/u/3408176?v=3&s=150">
74 </br>
75 <a href="https://github.com/TheLarkInn">Sean Larkin</a>
76 </td>
77 </tr>
78 <tbody>
79</table>
80
81
82[npm]: https://img.shields.io/npm/v/source-map-loader.svg
83[npm-url]: https://npmjs.com/package/source-map-loader
84
85[deps]: https://david-dm.org/webpack-contrib/source-map-loader.svg
86[deps-url]: https://david-dm.org/webpack-contrib/source-map-loader
87
88[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
89[chat-url]: https://gitter.im/webpack/webpack