Parcel: Error thrown when importing a .css file from within .scss file

Created on 25 Jul 2018  路  4Comments  路  Source: parcel-bundler/parcel

馃悰 bug report

When importing a .css file from within .scss file, an error with an unclear message is thrown:

~/Downloads/parcel-reproduce >>> npm run build                                                                                                                                

> [email protected] build /home/kuba/Downloads/parcel-reproduce
> parcel build index.html --out-dir=public

馃毃  /home/kuba/Downloads/parcel-reproduce/css/style.scss: Cannot resolve dependency '/home/kuba/Downloads/parcel-reproduce/home/kuba/Downloads/parcel-reproduce/css/reset.css' at '/home/kuba/Downloads/parcel-reproduce/home/kuba/Downloads/parcel-reproduce/css/reset.css'
    at Resolver.resolve (/home/kuba/Downloads/parcel-reproduce/node_modules/parcel-bundler/src/Resolver.js:69:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `parcel build index.html --out-dir=public`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I'm on parcel 1.9.7. It didn't happen on <=1.8.1, so it looks like a regression

馃帥 Configuration (.babelrc, package.json, cli command)

I've set up a minimal repository that reproduces this problem:

https://github.com/kuba-orlik/parcel-reproduce

Run npm run build to see the error message

馃 Expected Behavior

It should build the scss file

馃槸 Current Behavior

It throws an error message, as shown above

馃敠 Context

I've upgraded the parcel-bundler version in one of my projects and this error started appearing. Renaming the file from reset.css to reset.scss and adjusting the import fixes the issue - but the error message wasn't very helpful in realizing that it's the file extension that causes the problem.

馃捇 Code Sample

https://github.com/kuba-orlik/parcel-reproduce

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.9.7
| Node | v10.6.0
| npm/Yarn | 6.1.0
| Operating System | Linux Manjaro

Bug CSS Preprocessing

All 4 comments

Any progress on it? Why can't parcel handle css importing in scss files?

Got the same issue with:
parcel 1.12.3
Node: 10.7.0
OS: MacOS

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

Phew this problem still persists. Not for many - that seems to be a fact - but still. I've tried to install dart-sass which doesn't resolve the tilde operator correctly, so the problem seems to be to some degree with node-sass and parcel.
Edit:
On another project I omitted the file extension, which worked with dart-sass: @import '~react-day-picker/lib/style';

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidnagli picture davidnagli  路  3Comments

will-stone picture will-stone  路  3Comments

humphd picture humphd  路  3Comments

davidnagli picture davidnagli  路  3Comments

Niggler picture Niggler  路  3Comments