{"id":13677831,"url":"https://github.com/webpack-contrib/source-map-loader","last_synced_at":"2025-05-13T23:02:34.463Z","repository":{"id":17163072,"uuid":"19930136","full_name":"webpack-contrib/source-map-loader","owner":"webpack-contrib","description":"extract sourceMappingURL comments from modules and offer it to webpack","archived":false,"fork":false,"pushed_at":"2025-02-05T15:31:56.000Z","size":2219,"stargazers_count":374,"open_issues_count":6,"forks_count":84,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-18T09:56:08.093Z","etag":null,"topics":["sourcemaps","webpack-loader"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webpack-contrib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"webpack"}},"created_at":"2014-05-19T05:26:38.000Z","updated_at":"2025-04-18T02:10:15.000Z","dependencies_parsed_at":"2024-03-02T14:26:53.986Z","dependency_job_id":"8da646df-3e7a-494c-9fc4-2d53f80fee33","html_url":"https://github.com/webpack-contrib/source-map-loader","commit_stats":{"total_commits":143,"total_committers":32,"mean_commits":4.46875,"dds":0.7832167832167832,"last_synced_commit":"24d12d6a6684e63832a46bc68a564029711a7b2f"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack-contrib%2Fsource-map-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack-contrib%2Fsource-map-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack-contrib%2Fsource-map-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webpack-contrib%2Fsource-map-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webpack-contrib","download_url":"https://codeload.github.com/webpack-contrib/source-map-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251129741,"owners_count":21540708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sourcemaps","webpack-loader"],"created_at":"2024-08-02T13:00:47.685Z","updated_at":"2025-04-29T18:32:27.103Z","avatar_url":"https://github.com/webpack-contrib.png","language":"JavaScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/webpack/webpack\"\u003e\n    \u003cimg width=\"200\" height=\"200\" src=\"https://webpack.js.org/assets/icon-square-big.svg\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n[![npm][npm]][npm-url]\n[![node][node]][node-url]\n[![tests][tests]][tests-url]\n[![coverage][cover]][cover-url]\n[![discussion][discussion]][discussion-url]\n[![size][size]][size-url]\n\n# source-map-loader\n\nExtracts source maps from existing source files (from their \u003ccode\u003esourceMappingURL\u003c/code\u003e).\n\n## Getting Started\n\nTo begin, you'll need to install `source-map-loader`:\n\n```console\nnpm i -D source-map-loader\n```\n\nor\n\n```console\nyarn add -D source-map-loader\n```\n\nor\n\n```console\npnpm add -D source-map-loader\n```\n\nThen add the plugin to your `webpack` config. For example:\n\n**file.js**\n\n```js\nimport css from \"file.css\";\n```\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        enforce: \"pre\",\n        use: [\"source-map-loader\"],\n      },\n    ],\n  },\n};\n```\n\nThe `source-map-loader` extracts existing source maps from all JavaScript entries.\nThis includes both inline source maps as well as those linked via URL.\nAll 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/).\nThis loader is especially useful when using 3rd-party libraries having their own source maps.\nIf 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.\nThe `source-map-loader` will extract from any JavaScript file, including those in the `node_modules` directory.\nBe mindful in setting [include](https://webpack.js.org/configuration/module/#ruleinclude) and [exclude](https://webpack.js.org/configuration/module/#ruleexclude) rule conditions to maximize bundling performance.\n\nAnd run `webpack` via your preferred method.\n\n## Options\n\n|                          Name                           |     Type     |   Default   | Description                                    |\n| :-----------------------------------------------------: | :----------: | :---------: | :--------------------------------------------- |\n| **[`filterSourceMappingUrl`](#filtersourcemappingurl)** | `{Function}` | `undefined` | Allows to control `SourceMappingURL` behaviour |\n\n### filterSourceMappingUrl\n\nType: `Function`\nDefault: `undefined`\n\nAllows you to specify the behavior of the loader for `SourceMappingURL` comment.\n\nThe function must return one of the values:\n\n- `true` or `'consume'` - consume the source map and remove `SourceMappingURL` comment (default behavior)\n- `false` or `'remove'` - do not consume the source map and remove `SourceMappingURL` comment\n- `skip` - do not consume the source map and do not remove `SourceMappingURL` comment\n\nExample configuration:\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        enforce: \"pre\",\n        use: [\n          {\n            loader: \"source-map-loader\",\n            options: {\n              filterSourceMappingUrl: (url, resourcePath) =\u003e {\n                if (/broker-source-map-url\\.js$/i.test(url)) {\n                  return false;\n                }\n\n                if (/keep-source-mapping-url\\.js$/i.test(resourcePath)) {\n                  return \"skip\";\n                }\n\n                return true;\n              },\n            },\n          },\n        ],\n      },\n    ],\n  },\n};\n```\n\n## Examples\n\n### Ignoring Warnings\n\nTo ignore warnings, you can use the following configuration:\n\n**webpack.config.js**\n\n```js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        enforce: \"pre\",\n        use: [\"source-map-loader\"],\n      },\n    ],\n  },\n  ignoreWarnings: [/Failed to parse source map/],\n};\n```\n\nMore information about the `ignoreWarnings` option can be found [here](https://webpack.js.org/configuration/other-options/#ignorewarnings)\n\n## Contributing\n\nPlease take a moment to read our contributing guidelines if you haven't yet done so.\n\n[CONTRIBUTING](./.github/CONTRIBUTING.md)\n\n## License\n\n[MIT](./LICENSE)\n\n[npm]: https://img.shields.io/npm/v/source-map-loader.svg\n[npm-url]: https://npmjs.com/package/source-map-loader\n[node]: https://img.shields.io/node/v/source-map-loader.svg\n[node-url]: https://nodejs.org\n[tests]: https://github.com/webpack-contrib/source-map-loader/workflows/source-map-loader/badge.svg\n[tests-url]: https://github.com/webpack-contrib/source-map-loader/actions\n[cover]: https://codecov.io/gh/webpack-contrib/source-map-loader/branch/master/graph/badge.svg\n[cover-url]: https://codecov.io/gh/webpack-contrib/source-map-loader\n[discussion]: https://img.shields.io/github/discussions/webpack/webpack\n[discussion-url]: https://github.com/webpack/webpack/discussions\n[size]: https://packagephobia.now.sh/badge?p=source-map-loader\n[size-url]: https://packagephobia.now.sh/result?p=source-map-loader\n","funding_links":["https://opencollective.com/webpack"],"categories":["Plugins"],"sub_categories":["Rspack Loaders"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpack-contrib%2Fsource-map-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebpack-contrib%2Fsource-map-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebpack-contrib%2Fsource-map-loader/lists"}