monorepo-microservice-rbac/apps/aorta/scripts/loaders/style.loader.ts
2023-08-27 14:37:59 +08:00

31 lines
713 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const isDev = process.env.NODE_ENV === 'development' // 是否是开发模式
const styleLoadersArray = [
isDev ? 'style-loader' : MiniCssExtractPlugin.loader, // 开发环境使用style-looader,打包模式抽离css
{
loader: 'css-loader'
}
]
export const cssLoader = {
test: /.css$/, //匹配 css 文件
use: styleLoadersArray
}
export const lessLoader = {
test: /\.less$/,
use: [
...styleLoadersArray,
{
loader: 'less-loader',
options: {
lessOptions: {
// 如果要在less中写类型js的语法需要加这一个配置
javascriptEnabled: true
}
}
}
]
}