egoist / egoist/rollup-plugin-postcss
sass-loader: Resolve isn't looking at main fields like _index.scss
- Dominant language
- JavaScript
- Stars
- 689
- Forks
- 210
- PR merge metrics
- No merged PRs in 30d
Description
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](https://github.com/egoist/rollup-plugin-postcss/pull/334))
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.