build(projects): 增加代码规范

This commit is contained in:
2023-11-03 18:17:27 +08:00
parent 9a0b0505e9
commit 5e64ea27de
38 changed files with 14545 additions and 11926 deletions

View File

@@ -1,4 +1,4 @@
import {defineConfig, type UserConfigExport} from '@tarojs/cli'
import { defineConfig, type UserConfigExport } from '@tarojs/cli'
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'
import devConfig from './dev'
import prodConfig from './prod'
@@ -13,7 +13,7 @@ export default defineConfig(async (merge, {}) => {
640: 2.34 / 2,
750: 1,
375: 2,
828: 1.81 / 2
828: 1.81 / 2,
},
sourceRoot: 'src',
outputRoot: 'dist',
@@ -21,77 +21,77 @@ export default defineConfig(async (merge, {}) => {
defineConstants: {},
copy: {
patterns: [],
options: {}
options: {},
},
framework: 'vue3',
compiler: 'webpack5',
cache: {
enable: true // Webpack 持久化缓存配置建议开启。默认配置请参考https://docs.taro.zone/docs/config-detail#cache
enable: true, // Webpack 持久化缓存配置建议开启。默认配置请参考https://docs.taro.zone/docs/config-detail#cache
},
mini: {
postcss: {
pxtransform: {
enable: true,
config: {}
config: {},
},
url: {
enable: true,
config: {
limit: 1024 // 设定转换尺寸上限
}
limit: 1024, // 设定转换尺寸上限
},
},
cssModules: {
enable: false, // 默认为 false如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
generateScopedName: '[name]__[local]___[hash:base64:5]',
},
},
},
webpackChain(chain) {
chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
}
},
},
h5: {
publicPath: '/public/',
staticDirectory: 'static',
router: {
mode: 'hash'
mode: 'hash',
},
output: {
filename: 'js/[name].[hash:8].js',
chunkFilename: 'js/[name].[chunkhash:8].js'
chunkFilename: 'js/[name].[chunkhash:8].js',
},
miniCssExtractPluginOption: {
ignoreOrder: true,
filename: 'css/[name].[hash].css',
chunkFilename: 'css/[name].[chunkhash].css'
chunkFilename: 'css/[name].[chunkhash].css',
},
postcss: {
autoprefixer: {
enable: true,
config: {}
config: {},
},
cssModules: {
enable: true, // 默认为 false如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
generateScopedName: '[name]__[local]___[hash:base64:5]',
},
},
},
webpackChain(chain) {
chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
}
},
},
rn: {
appName: 'taroDemo',
postcss: {
cssModules: {
enable: false // 默认为 false如需使用 css modules 功能,则设为 true
}
}
}
enable: false, // 默认为 false如需使用 css modules 功能,则设为 true
},
},
},
}
if (process.env.NODE_ENV === 'development') {
// 本地开发构建配置(不混淆压缩)