{"id":16048977,"url":"https://github.com/sormy/webpack-source-map-fix-plugin","last_synced_at":"2025-06-16T06:40:12.221Z","repository":{"id":57397484,"uuid":"68164881","full_name":"sormy/webpack-source-map-fix-plugin","owner":"sormy","description":"Webpack Source Map Fix Plugin","archived":false,"fork":false,"pushed_at":"2016-09-17T04:15:46.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T16:18:32.202Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/sormy.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-14T02:12:26.000Z","updated_at":"2016-09-14T02:58:26.000Z","dependencies_parsed_at":"2022-09-12T20:50:53.629Z","dependency_job_id":null,"html_url":"https://github.com/sormy/webpack-source-map-fix-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sormy/webpack-source-map-fix-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sormy%2Fwebpack-source-map-fix-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sormy%2Fwebpack-source-map-fix-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sormy%2Fwebpack-source-map-fix-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sormy%2Fwebpack-source-map-fix-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sormy","download_url":"https://codeload.github.com/sormy/webpack-source-map-fix-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sormy%2Fwebpack-source-map-fix-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259292955,"owners_count":22835507,"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":[],"created_at":"2024-10-09T00:12:01.173Z","updated_at":"2025-06-16T06:40:12.186Z","avatar_url":"https://github.com/sormy.png","language":"JavaScript","readme":"# Webpack Source Map Fix Plugin #\n\n## DEPRECATION NOTICE ##\n\nThe same or even better effect could be reached without this plugin\nif you will use alternative webpack configuration for `devtoolModuleFilenameTemplate`:\n\n```javascript\nmodules.exports = {\n  ...\n\n  output: {\n    ...\n\n    devtoolModuleFilenameTemplate: function (info) {\n      var relPath = info.resourcePath\n        .replace(/^.*(~|node_modules)/, '~')\n        .replace(/^(webpack:\\/\\/\\/)+/, '')\n        .replace(/^\\.\\//, '')\n        .replace(/^\\(webpack\\)-/, '(webpack)/')\n        .replace(/^webpack\\/bootstrap/, '(webpack)/bootstrap');\n      return 'webpack:///' + relPath + '?' + info.hash;\n    }\n  }\n\n  ...\n};\n```\n\n## Why? ##\n\nHave you ever seen source map paths like below?\n\n- webpack:///./~/bla-bla-bla\n- webpack:///./bla-bla-bla\n- webpack:///~/bla-bla-bla\n- webpack:///webpack:///bla-bla-bla\n- webpack:///~/bla-bla-bla/~/bla-bla-bla\n- webpack:///(webpack)-bla-bla-bla\n- webpack:///(webpack)/bla-bla-bla\n- webpack:///webpack/bootstrap bla-bla-bla\n\nThis plugin performs a trivial fix on source map path to normalize path:\n\n```javascript\nvar relPath = path\n  .replace(/^.*~/, '~')\n  .replace(/^(webpack:\\/\\/\\/)+/, '')\n  .replace(/^\\.\\//, '')\n  .replace(/^\\(webpack\\)-/, '(webpack)/')\n  .replace(/^webpack\\/bootstrap/, '(webpack)/bootstrap');\nreturn 'webpack:///' + relPath + '?' + info.hash;\n```\n\n- `/~/` is well know alias for node_modules when css import is used\n- `/./` is relative to root import\n- `webpack:///webpack:///` comes from buggy url rewrite engine\n\n## Usage ##\n\n```shell\nnpm install webpack-source-map-fix-plugin --save-dev\n```\n\nwebpack.config.js:\n\n```javascript\n...\n\nvar SourceMapFixPlugin = require('webpack-source-map-fix-plugin');\n\nmodule.exports = {\n  ...\n  devtool: 'source-map',\n  ...\n  plugins: [\n    ...\n    new SourceMapFixPlugin()\n  ];\n  ...\n}\n```\n\n## Limitations ##\n\nCurrent verson will work only if source maps are bundled in separate files.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsormy%2Fwebpack-source-map-fix-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsormy%2Fwebpack-source-map-fix-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsormy%2Fwebpack-source-map-fix-plugin/lists"}