{"id":13563395,"url":"https://github.com/jsdf/webpack-combine-loaders","last_synced_at":"2025-07-06T22:07:46.761Z","repository":{"id":48001058,"uuid":"44946623","full_name":"jsdf/webpack-combine-loaders","owner":"jsdf","description":"Combine an array of webpack loaders into a loader string","archived":false,"fork":false,"pushed_at":"2022-12-06T22:39:50.000Z","size":517,"stargazers_count":105,"open_issues_count":8,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-28T22:57:31.340Z","etag":null,"topics":[],"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/jsdf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-26T04:48:20.000Z","updated_at":"2025-01-22T01:46:29.000Z","dependencies_parsed_at":"2023-01-24T11:45:27.500Z","dependency_job_id":null,"html_url":"https://github.com/jsdf/webpack-combine-loaders","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/jsdf/webpack-combine-loaders","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsdf%2Fwebpack-combine-loaders","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsdf%2Fwebpack-combine-loaders/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsdf%2Fwebpack-combine-loaders/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsdf%2Fwebpack-combine-loaders/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsdf","download_url":"https://codeload.github.com/jsdf/webpack-combine-loaders/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsdf%2Fwebpack-combine-loaders/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263980181,"owners_count":23538922,"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-08-01T13:01:18.741Z","updated_at":"2025-07-06T22:07:46.729Z","avatar_url":"https://github.com/jsdf.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# webpack-combine-loaders\n\nConverts an array of loaders defined using the `{loader, query}` object syntax into a single loader string. Useful for dealing with plugins which only understand the loader string syntax.\n\n```js\ncombineLoaders([\n  {\n    loader: 'css-loader',\n    query: {\n      modules: true,\n      sourceMap: true,\n      localIdentName: '[name]__[local]--[hash:base64:5]',\n    },\n  },\n  {\n    loader: 'sass-loader',\n    query: {\n      sourceMap: true,\n      includePaths: [\n        'app/assets/stylesheets',\n        'app/assets/stylesheets/legacy',\n      ],\n    },\n  },\n]);\n// =\u003e 'css-loader?modules=true\u0026sourceMap=true\u0026localIdentName=[name]__[local]--[hash:base64:5]!sass-loader?sourceMap=true\u0026includePaths[]=app/assets/stylesheets\u0026includePaths[]=app/assets/stylesheets/legacy'\n```\n## why?\n\nSay you have multiple loaders being applied to the same file format, and you are \nusing the object syntax for specifying the loader query params (because it's more \ncomposable than the string form), but then you need to pass them to a plugin which \nonly understands loaders in their string form (ExtractTextPlugin, I'm looking at you)...\n\n```js\n[\n  {\n    test: /\\.scss$/,\n    exclude: /node_modules/,\n    loader: 'css-loader',\n    query: {\n      modules: true,\n      sourceMap: devBuild,\n      localIdentName: '[name]__[local]--[hash:base64:5]',\n    },\n  },\n  {\n    test: /\\.scss$/,\n    exclude: /node_modules/,\n      loader: 'sass-loader',\n      query: {\n        sourceMap: devBuild,\n        includePaths: [\n          path.resolve('app/assets/stylesheets'),\n          path.resolve('app/assets/stylesheets/legacy'),\n        ],\n      },\n    },\n  }\n]\n```\n\nInstead, make a combined loader like so:\n```js\n{\n  test: /\\.scss$/,\n  exclude: /node_modules/,\n  // multiple css loaders are combined into one because ExtractTextPlugin \n  // only understands loaders in string form :(\n  loader: combineLoaders([\n    {\n      loader: 'css-loader',\n      query: {\n        modules: true,\n        sourceMap: devBuild,\n        localIdentName: '[name]__[local]--[hash:base64:5]',\n      },\n    },\n    {\n      loader: 'sass-loader',\n      query: {\n        sourceMap: devBuild,\n        includePaths: [\n          path.resolve('app/assets/stylesheets'),\n          path.resolve('app/assets/stylesheets/legacy'),\n        ],\n      },\n    },\n  ]),\n}\n```\n\n### Changelog\n\n- 2.0.4 - Upgrade `qs` dependency ([#10](https://github.com/jsdf/webpack-combine-loaders/pull/10)). Drops support for Node \u003c 4.\n- 2.0.3 - add support for webpack2 loader \"options\" (with fallback to \"query\")\n- 2.0.0 - no longer uri-encodes loader params\n- 1.0.0 - initial release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsdf%2Fwebpack-combine-loaders","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsdf%2Fwebpack-combine-loaders","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsdf%2Fwebpack-combine-loaders/lists"}