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-loader: Resolve isn't looking at main fields like _index.scss #333

Open
peterhass opened this issue Nov 6, 2020 · 0 comments
Open

Comments

@peterhass
Copy link

peterhass commented Nov 6, 2020

Since I use storybook and rollup in the same package, I noticed some differences in how module resolve during import works.

The package I am trying to import holds a file called _index.scss. node_modules/my-ui-kit/_index.scss
Inside some scss file I am trying to build, I try to import it like I would with webpack's sass-loader:

@import "~my-ui-kit";

webpack's sass-loader would load node_modules/my-ui-kit/_index.scss but rollup-plugin-postcss just fails. It falsely assumes that my-ui-kit is the partial and tries to load /_my-ui-kit/.

https://github.com/egoist/rollup-plugin-postcss/blob/master/src/sass-loader.js#L63
partialUrl = "/_my-ui-kit"

webpack sass-loader passes mainFields: ['_index', 'index'] to resolve - maybe we could use something like this too? https://github.com/webpack-contrib/sass-loader/blob/master/src/utils.js#L351

Would be open to do a PR if you could give me some initial support. (Update: PR)

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