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

Allow CSS preProcessors importers to run before the internal importer #10120

Closed
4 tasks done
menostos opened this issue Sep 14, 2022 · 0 comments · Fixed by #10101
Closed
4 tasks done

Allow CSS preProcessors importers to run before the internal importer #10120

menostos opened this issue Sep 14, 2022 · 0 comments · Fixed by #10101

Comments

@menostos
Copy link

Description

The current preprocessor configuration allows for customiziation of the underlying preprocessor. For sass and scss the options get merged with vite options for these processors. The Importer array will get merged with an internalImporter from vite.
The internalImporter handles all files which he can resolve. In my case there are also file types (json) which he can resolve, but cant make any sense of it, so failing the build.

The way it's implemented currently, with the internalImporter always first, makes it impossible to register a custom importers to act on the filesystem like node-sass-json-importer

Suggested solution

In order to handle other file types, i think it would be best, to prepend custom importers from user options. This would allow any importer to choose, if he handles the file or not.

This had to be implemented in (

const importer = [internalImporter]
if (options.importer) {
Array.isArray(options.importer)
? importer.push(...options.importer)
: importer.push(options.importer)
}
)

Alternative

An alternative would be to change the internalImporter to only handle files which he can, dependending on the preprocessor.

Additional context

No response

Validations

@sapphi-red sapphi-red linked a pull request Sep 18, 2022 that will close this issue
9 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants