Repository navigation
fix: resolve a data: resource from the loader's context - #1352
Conversation
🦋 Changeset detectedLatest commit: eb24f3f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The test loader sets this.context the way webpack/webpack#22940 does, so the test checks the loader on the released webpack too.
|
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
ef3dea51-5ee6-44ae-acfb-b1963ece5a88
Files selected for processing: 5-
.changeset/data-uri-resource.mdsrc/index.jssrc/utils.jstest/data-uri.test.jstest/helpers/dataUriContextLoader.cjs
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
-
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1352 +/- ##
==========================================
+ Coverage 96.62% 96.72% +0.09%
==========================================
Files 2 2
Lines 1007 1037 +30
==========================================
+ Hits 973 1003 +30
Misses 34 34 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
webpack's HTML support (webpack/webpack#22940) sends an inline
<style lang="scss">body to loaders as adata:text/x-scssmodule. Adata:URI has no path, so sass-loader resolved relative@use/@importagainst the URI itself and couldn't read the syntax from an extension.Now a
data:resource reads asstdin.scss/stdin.sassinthis.context, andtext/x-sassselects the indented syntax.Relative imports resolve from the page once webpack/webpack#22940 is released, which gives
data:modules their referrer's directory asthis.context; on older webpack this is a no-op. The test sets that context itself, so it runs on the released webpack.What kind of change does this PR introduce?
fix
Did you add tests for your changes?
Yes,
test/data-uri.test.js(relative@useand indented syntax from the media type); it fails without this fix.Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a (webpack.js.org#8462 documents inline
<style lang>).Use of AI
Written with Claude Code under my direction; I reviewed it.
🤖 Generated with Claude Code
https://claude.ai/code/session_0127uEXaa4uCDQstWhYDegGb
Summary by CodeRabbit
data:URIs. SCSS imports now resolve from the loader context, andtext/x-sassdata URIs are read as indented Sass syntax.data:URIs compile successfully and produce CSS.