Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If import URL is wrong but even if package urls are supported, dart-sass complains: "package:" URLs aren't supported on this platform. #630

Closed
AlexanderJohr opened this issue Mar 19, 2019 · 1 comment
Labels
bug cosmetic Doesn't affects CSS semantics

Comments

@AlexanderJohr
Copy link

I get the Error "package:" URLs aren't supported on this platform.

The error is resolved when the path is correct.

I ran into this issue when I renamed the package and hence the import urls needed to be updated.

dart-sass tries to import and if it didn't work and it is a package URL, it doesn't check if it was just a wrong url. It just assumes, that it is because package aren't isn't supported on that platform, even when they are.

It can be found in \visitor\evaluate.dart and \visitor\async_evaluate.dart:

if (url.startsWith('package:')) {

if (url.startsWith('package:')) {

// [...]
    try {
      if (_nodeImporter != null) {
        var stylesheet = _importLikeNode(url);
        if (stylesheet != null) return Tuple2(null, stylesheet);
      } else {
        var tuple = _importCache.import(
            Uri.parse(url), _importer, _stylesheet.span?.sourceUrl);
        if (tuple != null) return tuple;
      }
 
// AlexanderJohr: If the program reached here, the import didn't work. Could be because of wrong url or because package URLs aren't supported, but it just assumes, that it is because of package URLs not supported on the platform.
      if (url.startsWith('package:')) {
        // Special-case this error message, since it's tripped people up in the
        // past.
        throw "\"package:\" URLs aren't supported on this platform.";
      } else {
        throw "Can't find stylesheet to import.";
      }
    } on SassException catch (error) {
// [...]

But for now I'm not sure how to fix it myself.

@aaronlademann-wf
Copy link

I am seeing the same thing.

@nex3 nex3 added bug cosmetic Doesn't affects CSS semantics labels Mar 19, 2019
nex3 added a commit that referenced this issue Apr 3, 2019
@nex3 nex3 closed this as completed in #637 Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cosmetic Doesn't affects CSS semantics
Projects
None yet
Development

No branches or pull requests

3 participants