| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- import path from 'path';
- import { WX_VERSION } from './env';
- const CIPluginFn = {
- weapp: {
- appid: 'wxe1396d16d519e16b',
- privateKeyPath: 'ci/ca/private.wxe1396d16d519e16b.key',
- robot: 1,
- },
- version: WX_VERSION,
- desc: '自动发布测试1'
- };
- const config = {
- projectName: 'hola',
- date: '2023-10-5',
- designWidth: 750,
- deviceRatio: {
- 640: 2.34 / 2,
- 750: 1,
- 828: 1.81 / 2
- },
- sourceRoot: 'src',
- outputRoot: 'dist',
- plugins: [['@tarojs/plugin-mini-ci', CIPluginFn]],
- defineConstants: {
- },
- copy: {
- patterns: [
- // {
- // from: `node_modules/tdesign-miniprogram-taro/miniprogram_dist/`,
- // to: `dist/miniprogram_npm/tdesign-miniprogram/`,
- // ignore: ['*.ts', '*.map', 'type.js']
- // },
- ],
- options: {
- }
- },
- framework: 'react',
- compiler: 'webpack5',
- cache: {
- enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
- },
- alias: {
- '@': path.resolve(__dirname, '..', 'src'), // 这样配置后 @ 可以指向 src 目录
- '@components': path.resolve(__dirname, '../src/components'),
- '@assets': path.resolve(__dirname, '..', 'src/assets'),
- '@utils': path.resolve(__dirname, '..', 'src/utils'),
- '@features': path.resolve(__dirname, '..', 'src/features'),
- '@services': path.resolve(__dirname, '..', 'src/services'),
- },
- mini: {
- miniCssExtractPluginOption: {
- ignoreOrder: true
- },
- postcss: {
- pxtransform: {
- enable: true,
- config: {
- }
- },
- url: {
- enable: true,
- config: {
- limit: 1024 // 设定转换尺寸上限
- }
- },
- cssModules: {
- enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
- config: {
- namingPattern: 'module', // 转换模式,取值为 global/module
- generateScopedName: '[name]__[local]___[hash:base64:5]'
- }
- }
- }
- },
- h5: {
- publicPath: '/',
- staticDirectory: 'static',
- postcss: {
- autoprefixer: {
- enable: true,
- config: {
- }
- },
- cssModules: {
- enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
- config: {
- namingPattern: 'module', // 转换模式,取值为 global/module
- generateScopedName: '[name]__[local]___[hash:base64:5]'
- }
- }
- }
- },
- rn: {
- appName: 'taroDemo',
- alias: {
- '@': path.resolve(__dirname, '..', 'src'), // 这样配置后 @ 可以指向 src 目录
- '@components': path.resolve(__dirname, '../src/components'),
- '@assets': path.resolve(__dirname, '..', 'src/assets'),
- '@utils': path.resolve(__dirname, '..', 'src/utils'),
- '@features': path.resolve(__dirname, '..', 'src/features'),
- '@services': path.resolve(__dirname, '..', 'src/services'),
- },
- output: {
- ios: './ios/main.jsbundle',
- iosAssetsDest: './ios',
- android: './android/app/src/main/assets/index.android.bundle',
- androidAssetsDest: './android/app/src/main/res',
- // iosSourceMapUrl: '',
- iosSourcemapOutput: './ios/main.map',
- // iosSourcemapSourcesRoot: '',
- // androidSourceMapUrl: '',
- androidSourcemapOutput: './android/app/src/main/assets/index.android.map',
- // androidSourcemapSourcesRoot: '',
- },
- postcss: {
- cssModules: {
- enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
- }
- }
- }
- }
- module.exports = function (merge) {
- if (process.env.NODE_ENV === 'development') {
- return merge({}, config, require('./dev'))
- }
- return merge({}, config, require('./prod'))
- }
|