node-sass: Import errors when there both a .css and .scss file in the specified location.

Given dependency path that has both:

foo.css
foo.scss

Attempting to import foo.scss in a dependent file:

@import 'foo';

results in an error:

{ “message”: “It’s not clear which file to import for ‘@import "foo"’.\nCandidates:\n foo.scss\n foo.css\nPlease delete or rename all but one of these files.\n”, “column”: 1, “line”: 1, “file”: “application.scss”, “status”: 1 }

This worked prior to the recent update. Is this change intentional, bug? Explicitly specifying the extension in the @import statement resolves the issue for a particular case, however this is breaking for many components.

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Comments: 27 (14 by maintainers)

Most upvoted comments

I am also getting this issue when there is two .scss files, but one is proceeded with an underscore. For example:

@import "path/to/foo";

And then in the /path/to/ directory, I have both foo.scss and _foo.scss.

This was working prior to 3.4.0.

Doesn’t this completely defeat the purpose of having an extension-less version of @import? Since an .scss file will usually be accompanied by a (generated) .css file, you will never be able to import it without explicitly specifying the extension. This sounds like a bug to me, especially since the error message says:

Please delete or rename all but one of these files.

Sure… I’ll delete one, only to have it reappear next time I update the other.