index.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. const path = require('path')
  2. const config = {
  3. projectName: 'myApp',
  4. date: '2020-8-7',
  5. designWidth: 750,
  6. deviceRatio: {
  7. 640: 2.34 / 2,
  8. 750: 1,
  9. 828: 1.81 / 2
  10. },
  11. sourceRoot: 'src',
  12. outputRoot: 'dist',
  13. plugins: [],
  14. defineConstants: {
  15. },
  16. copy: {
  17. patterns: [
  18. {from: 'src/towxml', to:'dist/towxml'}
  19. ],
  20. options: {
  21. }
  22. },
  23. framework: 'vue',
  24. mini: {
  25. postcss: {
  26. pxtransform: {
  27. enable: true,
  28. config: {
  29. }
  30. },
  31. url: {
  32. enable: true,
  33. config: {
  34. limit: 1024 // 设定转换尺寸上限
  35. }
  36. },
  37. cssModules: {
  38. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  39. config: {
  40. namingPattern: 'module', // 转换模式,取值为 global/module
  41. generateScopedName: '[name]__[local]___[hash:base64:5]'
  42. }
  43. }
  44. }
  45. },
  46. h5: {
  47. publicPath: '/',
  48. staticDirectory: 'static',
  49. postcss: {
  50. autoprefixer: {
  51. enable: true,
  52. config: {
  53. }
  54. },
  55. cssModules: {
  56. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  57. config: {
  58. namingPattern: 'module', // 转换模式,取值为 global/module
  59. generateScopedName: '[name]__[local]___[hash:base64:5]'
  60. }
  61. }
  62. }
  63. },
  64. alias: {
  65. '@/components': path.resolve(__dirname, '..', 'src/components'),
  66. '@/util': path.resolve(__dirname, '..', 'src/util')
  67. }
  68. }
  69. module.exports = function (merge) {
  70. if (process.env.NODE_ENV === 'development') {
  71. return merge({}, config, require('./dev'))
  72. }
  73. return merge({}, config, require('./prod'))
  74. }