使用craco配置全局sass
下载craco-sass-resources-loader
yarn add craco-sass-resources-loader
npm i -d craco-sass-resources-loader
在craco.config.js
中配置
const sassResourcesLoader = require('craco-sass-resources-loader');
module.exports = {
plugins: [
{
plugin: sassResourcesLoader,
options: {
resources: [
'./src/assets/styles/common/common.scss',
'./src/assets/styles/common/global.scss',
'./src/assets/styles/common/keyframes.scss',
'./src/assets/styles/common/media.scss',
'./src/assets/styles/other/hover-min.scss',
'./src/assets/styles/other/normal.scss',
],
},
},
],
}