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

Sass "Absolute Path" Module Resolution Fails #2431

Closed
evanleck opened this issue Dec 18, 2018 · 2 comments · Fixed by #2432
Closed

Sass "Absolute Path" Module Resolution Fails #2431

evanleck opened this issue Dec 18, 2018 · 2 comments · Fixed by #2432
Labels

Comments

@evanleck
Copy link

🐛 bug report

Importing Sass files fails when using the absolute path approach to module resolution.

🎛 Configuration (.babelrc, package.json, cli command)

{
  "name": "parcel-1403-reproduction-sass",
  "scripts": {
    "serve": "parcel src/index.html"
  },
  "devDependencies": {
    "parcel": "^1.10.3",
    "sass": "^1.15.2"
  },
  "dependencies": {
    "normalize.css": "^8.0.1"
  }
}

🤔 Expected Behavior

Sass imports should work with absolute path-style module resolution.

😯 Current Behavior

An error is thrown:

> parcel src/index.html

Server running at http://localhost:1234
🚨  /Users/evan/Code/parcel-1403-reproduction-sass/src/styles/index.scss:3:9: Can't find stylesheet to import.
@import '/styles/_variables.scss';
        ^^^^^^^^^^^^^^^^^^^^^^^^^
  stdin 3:9  root stylesheet
Error: Can't find stylesheet to import.
@import '/styles/_variables.scss';
        ^^^^^^^^^^^^^^^^^^^^^^^^^
  stdin 3:9  root stylesheet

💁 Possible Solution

I'm not sure, but does the sass package not use the same module resolution algorithm? The docs suggest that all supported asset types should work.

🔦 Context

I ran into this while attempting to reproduce issue #1403 which I came to because I'm unable to import normalize.css into a project.

💻 Code Sample

https://github.com/evanleck/parcel-1403-reproduction-sass

🌍 Your Environment

Software Version(s)
Parcel 1.10.3
Node 10.14.0
npm/Yarn npm 6.5.0
Operating System macOS 10.14.2
@DeMoorJasper
Copy link
Member

It appears absolute paths are preceded by file:// in sass for some reason. Seems like a very strange concept.

@evanleck
Copy link
Author

@DeMoorJasper you're fast! Thanks for getting a patch in so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants