text: /*
   * Copyright 2019. the original author or authors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  const path = require('path')
  
  const config = {
    projectName: 'todo',
    date: '2019-4-8',
    designWidth: 750,
    deviceRatio: {
      '640': 2.34 / 2,
      '750': 1,
      '828': 1.81 / 2
    },
    sourceRoot: 'src',
    outputRoot: 'dist',
    plugins: {
      babel: {
        sourceMap: true,
        presets: [
          ['env', {
            modules: false
          }]
        ],
        plugins: [
          'transform-decorators-legacy',
          'transform-class-properties',
          'transform-object-rest-spread'
        ]
      }
    },
    defineConstants: {
      API_SERVER: ""
    },
    alias: {
      '@components': path.resolve(__dirname, '..', 'src/components'),
      '@services': path.resolve(__dirname, '..', 'src/services'),
      '@utils': path.resolve(__dirname, '..', 'src/utils')
    },
    copy: {
      patterns: [],
      options: {}
    },
    weapp: {
      module: {
        postcss: {
          autoprefixer: {
            enable: true,
            config: {
              browsers: [
                'last 3 versions',
                'Android >= 4.1',
                'ios >= 8'
              ]
            }
          },
          pxtransform: {
            enable: true,
            config: {}
          },
          url: {
            enable: true,
            config: {
              limit: 10240 // 设定转换尺寸上限
            }
          },
          cssModules: {
            enable: false, // 默认为 false，如需使用 css modules 功能，则设为 true
            config: {
              namingPattern: 'module', // 转换模式，取值为 global/module
              generateScopedName: '[name]__[local]___[hash:base64:5]'
            }
          }
        }
      }
    },
    h5: {
      publicPath: '/',
      staticDirectory: 'static',
      esnextModules: ['taro-ui'],
      module: {
        postcss: {
          autoprefixer: {
            enable: true,
            config: {
              browsers: [
                'last 3 versions',
                'Android >= 4.1',
                'ios >= 8'
              ]
            }
          },
          cssModules: {
            enable: false, // 默认为 false，如需使用 css modules 功能，则设为 true
            config: {
              namingPattern: 'module', // 转换模式，取值为 global/module
              generateScopedName: '[name]__[local]___[hash:base64:5]'
            }
          }
        }
      }
    }
  }
  
  module.exports = function (merge) {
    if (process.env.NODE_ENV === 'uat') {
      return merge({}, config, require('./uat'))
    } else if (process.env.NODE_ENV === 'prod') {
      return merge({}, config, require('./prod'))
    }
    return merge({}, config, require('./dev'))
  }
  