index.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. ],
  19. options: {
  20. }
  21. },
  22. framework: 'vue',
  23. mini: {
  24. postcss: {
  25. pxtransform: {
  26. enable: true,
  27. config: {
  28. }
  29. },
  30. url: {
  31. enable: true,
  32. config: {
  33. limit: 1024 // 设定转换尺寸上限
  34. }
  35. },
  36. cssModules: {
  37. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  38. config: {
  39. namingPattern: 'module', // 转换模式,取值为 global/module
  40. generateScopedName: '[name]__[local]___[hash:base64:5]'
  41. }
  42. }
  43. }
  44. },
  45. h5: {
  46. publicPath: '/',
  47. staticDirectory: 'static',
  48. postcss: {
  49. autoprefixer: {
  50. enable: true,
  51. config: {
  52. }
  53. },
  54. cssModules: {
  55. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  56. config: {
  57. namingPattern: 'module', // 转换模式,取值为 global/module
  58. generateScopedName: '[name]__[local]___[hash:base64:5]'
  59. }
  60. }
  61. }
  62. },
  63. alias: {
  64. '@/components': path.resolve(__dirname, '..', 'src/components'),
  65. '@/util': path.resolve(__dirname, '..', 'src/util')
  66. }
  67. }
  68. module.exports = function (merge) {
  69. if (process.env.NODE_ENV === 'development') {
  70. return merge({}, config, require('./dev'))
  71. }
  72. return merge({}, config, require('./prod'))
  73. }