feat: tailwindcss
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { defineConfig } from '@tarojs/cli'
|
||||
import { UnifiedWebpackPluginV5 } from 'weapp-tailwindcss/webpack'
|
||||
import {defineConfig} from '@tarojs/cli'
|
||||
|
||||
import devConfig from './dev'
|
||||
import prodConfig from './prod'
|
||||
|
||||
// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数
|
||||
export default defineConfig(async (merge, { command, mode }) => {
|
||||
export default defineConfig(async (merge, {command, mode}) => {
|
||||
const baseConfig = {
|
||||
projectName: 'taro-template',
|
||||
date: '2024-12-18',
|
||||
@@ -18,13 +19,10 @@ export default defineConfig(async (merge, { command, mode }) => {
|
||||
sourceRoot: 'src',
|
||||
outputRoot: 'dist',
|
||||
plugins: [],
|
||||
defineConstants: {
|
||||
},
|
||||
defineConstants: {},
|
||||
copy: {
|
||||
patterns: [
|
||||
],
|
||||
options: {
|
||||
}
|
||||
patterns: [],
|
||||
options: {}
|
||||
},
|
||||
framework: 'react',
|
||||
compiler: 'webpack5',
|
||||
@@ -35,9 +33,7 @@ export default defineConfig(async (merge, { command, mode }) => {
|
||||
postcss: {
|
||||
pxtransform: {
|
||||
enable: true,
|
||||
config: {
|
||||
|
||||
}
|
||||
config: {}
|
||||
},
|
||||
cssModules: {
|
||||
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
|
||||
@@ -46,6 +42,20 @@ export default defineConfig(async (merge, { command, mode }) => {
|
||||
generateScopedName: '[name]__[local]___[hash:base64:5]'
|
||||
}
|
||||
}
|
||||
},
|
||||
webpackChain(chain, webpack) {
|
||||
chain.merge({
|
||||
plugin: {
|
||||
install: {
|
||||
plugin: UnifiedWebpackPluginV5,
|
||||
args: [{
|
||||
appType: 'taro',
|
||||
// 下面个配置,会开启 rem -> rpx 的转化
|
||||
rem2rpx: true
|
||||
}]
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
h5: {
|
||||
|
||||
Reference in New Issue
Block a user