Comments (2)
In #2077, we (correctly) fixed a bug by making the current importer for a given file unable to load absolute URLs. Now absolute URLs are only ever handled by the set of importers the user passes in explicitly. However, this means that if the user doesn't pass in any importers that can handle absolute file:
URLs, they can't be loaded at all. Although this is arguably desirable in general, since it means the importers
and loadPaths
options are fully authoritative for which absolute URLs can be loaded, it causes several knock-on issues.
The first knock-on issue is the one reported here. In the stylesheet graph we use to determine when updates are necessary, the import cache doesn't have a global FilesystemImporter
. This means that it doesn't know how to load absolute file:
URLs (which absolute paths on the CLI get converted into), so they're treated as "new files" and always recompiled.
The second knock-on issue is maybe even worse: stylesheets compiled by path on the CLI can't load absolute file:
URLs at all through @use
or @import
. Users can work around this by passing a --load-path
, but these loads should work by default.
The third knock-on issue is actually much broader, and actually predates #2077. The question is: what filesystem importer do we add to the import cache to fix the previous two issues? And we don't currently have a good answer. The problem is that there's currently only one type of filesystem importer: it takes a load path as an argument and handles both absolute file:
URLs and relative URLs, which it tries to resolve relative to its load path. But in cases like the ones above, the user doesn't want to add a load path. They just want to be able to load absolute URLs.
Our current standard answer to this is FilesystemImporter.cwd
, which has .
as its load path. But this is unsuitable, because it means that any Sass file anywhere can @use
a relative URL and have it be resolved relative to the process's working directory, which is almost certainly not intended. In fact, I think exposing FilesystemImporter.cwd
at all was a mistake. Instead, I think we need to deprecate that and provide a new FilesystemImporter
field that only supports loading absolute file:
URLs and URLs relative to the current file.
from dart-sass.
The latest 1.74.1 release has fixed the issue for the user of our library, thanks!
I won't close the issue as there's still a task open, but from my point of view it's fixed.
from dart-sass.
Related Issues (20)
- Add WASM compilation target HOT 2
- @use file cannot use variables starting with $-- HOT 1
- Setup arm64 linux/windows runners for AOT releases HOT 5
- dart-sass maven plugin 1.77.4 is not a Win32 valid application HOT 4
- Silent comments are incorrectly preserved in at-rule values
- NPM Pack is failing for version 1.62.1 HOT 2
- Install defaults to C:/Tools on Windows!!! HOT 1
- Switching git branches while in watch mode causes 'can't find stylesheet to import' HOT 3
- 1.77.7 wasn't published to NPM HOT 1
- `mixed_decls` produces too much noise for developers with mixins HOT 38
- An option to make nested warning (and similar warnings) fatal HOT 1
- sass --embedded doesn't reliably exit when closing stdin on Windows HOT 4
- trying ignore `mixed-decls` warning but still got these warning in Vite(`5.3.1`). HOT 5
- Bug: SASS variable not being replaced with actual value for CSS custom property within mixin HOT 5
- Can't access this.options.file in custom functions of sass.compile HOT 2
- Update to mimic new CSS nesting appears to break use of @include HOT 1
- Ensure that all Sass source URLs are canonical HOT 1
- How to prevent global variable re-defined when imported more than once? HOT 1
- Shadowed variables override outer scope HOT 2
- --watch doesn't recompile unless the file was changed in last ~10 s HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dart-sass.