You can resolve the read type of preprocessorOptions
set in thevite.config.ts
file.
Click here for the package repository
Install
npm i -D ts-css-modules-vite-plugin
Add it to the tsconfig.json
{
"compilerOptions": {
...
"plugins": [{"name": "ts-css-modules-vite-plugin"}]
},
}
Demo
Resolve the vite.config.ts
Resolve the preprocessorOptions
setting within the plugin.
import path from "path";
import { defineConfig } from "vite";
export default defineConfig({
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "@/styles" as common;`,
importer(...args) {
if (args[0] !== "@/styles") {
return;
}
return {
file: `${path.resolve(__dirname, "./src/assets/styles")}`,
};
},
},
},
});
Top comments (0)