-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Description
Clear and concise description of the problem
Currently, vite seems to be overriding the importer option of the css preprocessor option.
I want to make additional settings so that it will not be overwritten, or perform a special import. (For example, json importer)
If you have time to work, we are considering submitting a PR.
Suggested solution
Below is the implementation location for setting the preprocessor option.
vite/packages/vite/src/node/plugins/css.ts
Lines 907 to 916 in 6d602a0
| const scss: StylePreprocessor = async (source, root, options, resolvers) => { | |
| const render = loadPreprocessor(PreprocessLang.sass, root).render | |
| const finalOptions: Sass.Options = { | |
| ...options, | |
| data: await getSource(source, options.filename, options.additionalData), | |
| file: options.filename, | |
| outFile: options.filename, | |
| importer(url, importer, done) { | |
| resolvers.sass(url, importer).then((resolved) => { | |
| if (resolved) { |
At this location, you should be able to merge user-configured importers or importers injected by custom plugins as a list.
Alternative
I can't think of an alternative to this request so far.
Additional context
As an option in sass's JavaScript API, the importer is defined to be able to accept multiple list settings.
https://github.com/sass/node-sass#importer--v200---experimental