Gathering detailed insights and metrics for resolve-url-loader
Gathering detailed insights and metrics for resolve-url-loader
Gathering detailed insights and metrics for resolve-url-loader
Gathering detailed insights and metrics for resolve-url-loader
craco-resolve-url-loader
A resolve-url-loader plugin for craco
nuxt-resolve-url-loader
Nuxt module for adding resolve-url-loader to webpack config.
postcss-resolve-url
PostCSS plugin which resolve relative url problems in css-loader
@ibrahim-rahhal/resolve-url-loader
Webpack loader that resolves relative paths in url() statements based on the original source file
Webpack loader that resolves relative paths in url() statements based on the original source file
npm install resolve-url-loader
Typescript
Module System
Min. Node Version
Node Version
NPM Version
97.3
Supply Chain
99.5
Quality
76.1
Maintenance
100
Vulnerability
100
License
JavaScript (99.93%)
SCSS (0.07%)
Total Downloads
1,635,707,377
Last Day
378,580
Last Week
8,100,254
Last Month
35,040,699
Last Year
393,430,743
566 Stars
333 Commits
71 Forks
7 Watchers
7 Branches
16 Contributors
Updated on Jun 18, 2025
Minified
Minified + Gzipped
Latest Version
5.0.0
Package Id
resolve-url-loader@5.0.0
Unpacked Size
108.63 kB
Size
27.93 kB
File Count
19
NPM Version
6.14.15
Node Version
12.22.8
Cumulative downloads
Total Downloads
Last Day
-11%
378,580
Compared to previous day
Last Week
-10%
8,100,254
Compared to previous week
Last Month
2.1%
35,040,699
Compared to previous month
Last Year
7.4%
393,430,743
Compared to previous year
This webpack loader allows you to have a distributed set SCSS files and assets co-located with those SCSS files.
Where are your assets?
How complicated is your SASS?
@mixin
s.What asset paths are you using?
url(./foo.png)
or url(foo.png)
url(/foo.png)
url(~stuff/foo.png
)url($variable/foo.png)
What webpack errors are you getting?
foo.png
😞fully/resolved/path/foo.png
😕If you can tick at least 1 item in all of these questions then use this loader. It will allow webpack to find assets with fully relative paths.
If for any question you can't tick any items then webpack should be able to already find your assets. You don't need this loader. 🤷
Once webpack resolves your assets (even if it complains about loading them) then this loading is working correctly. 👍
When you use fully relative paths in url()
statements then Webpack expects to find those assets next to the root SCSS file, regardless of where you specify the url()
.
To illustrate here are 3 simple examples of SASS and Webpack without resolve-url-loader
.
The first 2 cases are trivial and work fine. The asset is specified in the root SCSS file and Webpack finds it.
But any practical SASS composition will have nested SCSS files, as in the 3rd case. Here Webpack cannot find the asset.
Module not found: Can't resolve './cool.png' in '/absolute/path/.../my-project/src/styles.scss'
The path we present to Webpack really needs to be ./subdir/cool.png
but we don't want to write that in our SCSS. 😒
Luckily we can use resolve-url-loader
to do the url re-writing and make it work. 😊🎉
With functions and mixins and multiple nesting it gets more complicated. Read more detail in how the loader works. 🤓
Upgrading? the changelog shows how to migrate your webpack config.
via npm
1npm install resolve-url-loader --save-dev
via yarn
1yarn add resolve-url-loader --dev
The typical use case is resolve-url-loader
between sass-loader
and css-loader
.
⚠️ IMPORTANT
resolve-url-loader
(regardless of devtool
).-loader
) otherwise you can get errors that are hard to debug.1rules: [ 2 { 3 test: /\.scss$/, 4 use: [ 5 ... 6 { 7 loader: 'css-loader', 8 options: {...} 9 }, { 10 loader: 'resolve-url-loader', 11 options: {...} 12 }, { 13 loader: 'sass-loader', 14 options: { 15 sourceMap: true, // <-- !!IMPORTANT!! 16 } 17 } 18 ] 19 }, 20 ... 21]
The loader should work without options but use these as required.
option | type | default | description | |
---|---|---|---|---|
sourceMap | boolean | false | Generate an outgoing source-map. | |
removeCR | boolean | true Windows OSfalse otherwise | Convert orphan CR to whitespace. See known issues below. | |
debug | boolean | false | Display debug information. | |
silent | boolean | false | Do not display warnings or deprecation messages. | |
root | string | unset | Similar to the (now defunct) option in css-loader .This string, possibly empty, is prepended to absolute URIs. Absolute URIs are only processed if this option is set. | |
join | function | inbuilt | advanced | Custom join function. Use custom javascript to fix asset paths on a per-case basis. Refer to the advanced features docs. |
Tested macOS
and Windows
.
All webpack@4
-webpack@5
with contemporaneous loaders/plugins using node@12
.
Refer to test
directory for full webpack configurations as used in automated tests.
Read the troubleshooting docs before raising an issue.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
Found 0/10 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
25 existing vulnerabilities detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More