admin管理员组文章数量:1025588
I have a Vite/React/Typescript app configured with sass and I would like to:
- Import the styles as named imports:
import { styles } from "my-component.styles.scss";
- Configure Vite (or sass) to recognize all
*.styles.scss
files as css modules as it happens for*.modules.scss
Here is my Vite config file
/// <reference types="vitest" />
import react from "@vitejs/plugin-react-swc";
import path from "path";
import { defineConfig } from "vite";
// /config/
export default defineConfig({
plugins: [react()],
},
css: {
preprocessorOptions: {
scss: {
api: "modern-compiler"
}
},
modules: {
localsConvention: "camelCase"
}
}
});
I have a Vite/React/Typescript app configured with sass and I would like to:
- Import the styles as named imports:
import { styles } from "my-component.styles.scss";
- Configure Vite (or sass) to recognize all
*.styles.scss
files as css modules as it happens for*.modules.scss
Here is my Vite config file
/// <reference types="vitest" />
import react from "@vitejs/plugin-react-swc";
import path from "path";
import { defineConfig } from "vite";
// /config/
export default defineConfig({
plugins: [react()],
},
css: {
preprocessorOptions: {
scss: {
api: "modern-compiler"
}
},
modules: {
localsConvention: "camelCase"
}
}
});
本文标签:
版权声明:本文标题:reactjs - How to have named imports and custom file names with Vite, React, Typescript and SCCS modules - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1741658878a1881039.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论