feat: app功能基本实现
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { defineConfig, type UserConfigExport } from '@tarojs/cli'
|
||||
import path from 'path'
|
||||
|
||||
import devConfig from './dev'
|
||||
import prodConfig from './prod'
|
||||
|
||||
// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数
|
||||
export default defineConfig<'vite'>(async merge => {
|
||||
const themeVariablesPath = path.resolve(__dirname, '..', 'src/theme/variables.scss').replace(/\\/g, '/')
|
||||
|
||||
const baseConfig: UserConfigExport<'vite'> = {
|
||||
projectName: 'app',
|
||||
date: '2026-5-6',
|
||||
@@ -17,11 +19,17 @@ export default defineConfig<'vite'>(async merge => {
|
||||
},
|
||||
sourceRoot: 'src',
|
||||
outputRoot: 'dist',
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, '..', 'src')
|
||||
},
|
||||
plugins: [
|
||||
"@tarojs/plugin-generator"
|
||||
'@tarojs/plugin-generator'
|
||||
],
|
||||
defineConstants: {
|
||||
},
|
||||
sass: {
|
||||
data: `@use "${themeVariablesPath}" as *;\n`
|
||||
},
|
||||
copy: {
|
||||
patterns: [
|
||||
],
|
||||
@@ -39,9 +47,9 @@ export default defineConfig<'vite'>(async merge => {
|
||||
}
|
||||
},
|
||||
cssModules: {
|
||||
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
|
||||
enable: false,
|
||||
config: {
|
||||
namingPattern: 'module', // 转换模式,取值为 global/module
|
||||
namingPattern: 'module',
|
||||
generateScopedName: '[name]__[local]___[hash:base64:5]'
|
||||
}
|
||||
}
|
||||
@@ -62,9 +70,9 @@ export default defineConfig<'vite'>(async merge => {
|
||||
config: {}
|
||||
},
|
||||
cssModules: {
|
||||
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
|
||||
enable: false,
|
||||
config: {
|
||||
namingPattern: 'module', // 转换模式,取值为 global/module
|
||||
namingPattern: 'module',
|
||||
generateScopedName: '[name]__[local]___[hash:base64:5]'
|
||||
}
|
||||
}
|
||||
@@ -74,17 +82,15 @@ export default defineConfig<'vite'>(async merge => {
|
||||
appName: 'taroDemo',
|
||||
postcss: {
|
||||
cssModules: {
|
||||
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
|
||||
enable: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// 本地开发构建配置(不混淆压缩)
|
||||
return merge({}, baseConfig, devConfig)
|
||||
}
|
||||
// 生产构建配置(默认开启压缩混淆等)
|
||||
|
||||
return merge({}, baseConfig, prodConfig)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user