forked from Anidetrix/rollup-plugin-styles
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I'm facing an issue when trying to use storybook + vite on my components lib, because vite scss loader doesn't
need ~ to resolve imports from node_modules, but this lib needs to (and SCSS standards as far as I know), so I did add an importer for the scss property from the options that handles this issue, and I think it should be included in the default scss importer.
I took the importer from your package and changed it a bit to the following:
importer: (url: string, importer: string) => {
if (path.isAbsolute(url) || url.startsWith('.')) return null;
const partialUrl = getUrlOfPartial(url);
const options = {
caller: 'Sass importer',
basedirs: [path.dirname(importer)],
extensions: stylesExtensions,
packageFilter: packageFilterBuilder({ conditions }),
};
try {
return finalize(resolveSync([partialUrl, url], options));
} catch {
return null;
}
}we can improve even the default importer you have to handle both cases,
I'll try to open a PR to handle them
Metadata
Metadata
Assignees
Labels
No labels