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)
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too