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

@use should grab _index.scss when pulling in an npm package that has a js file for main #878

Closed
davejtoews opened this issue Aug 11, 2020 · 1 comment

Comments

@davejtoews
Copy link

This is related to #804 and #535

  • Operating System: MacOS/Docker
  • Node Version: 13.3.0
  • NPM Version: 6.14.4
  • webpack Version: 4.29.6
  • sass-loader Version: 9.0.2
  • sass Version: 1.26.10
  • fibers Version: 5.0.0

I'm using sass and fibers rather than node-sass

Expected Behavior / Situation

I'm using an NPM module with both js and scss pieces. The main attribute in package.json is dist/main.js, the sass attribute is _index.scss. I would like to be able to import my js with import module from 'module'; and import my scss with @use '~module';

Actual Behavior / Situation

The sass fails to build unless I change the import statement to @use '~module/index';. I can also get this to work by changing the main attribute in the modules package.json to point to _index.scss.

Modification Proposal

A comment in #535 suggests I may be able to use webpack's resolve as a workaround, but as per the Sass docs, calling @use on a directory should automatically pull in the _index.scss file.

@davejtoews
Copy link
Author

I had a typo. Things work as expected. Sorry for the spam.

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

No branches or pull requests

1 participant