直接在 vite.config.ts 写入以下代码就可以了
import path from 'path'
css: {
preprocessorOptions: {
less: {
modifyVars: {
hack: `true; @import (reference) "${path.resolve('src/assets/styles/color.less')}";`,
},
javascriptEnabled: true
}
}
},
如果 path报错 改为
import {resolve} from 'path'
css: {
preprocessorOptions: {
less: {
modifyVars: {
hack: `true; @import (reference) "${resolve('src/assets/styles/color.less')}";`,
},
javascriptEnabled: true
}
}
},
网友评论