微信小程序,访客邀约
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

125 行
3.1 KiB

  1. import Components from 'unplugin-vue-components/webpack';
  2. import NutUIResolver from '@nutui/auto-import-resolver';
  3. const config = {
  4. projectName: 'wxapp-visitor-invert',
  5. date: '2023-12-18',
  6. designWidth (input) {
  7. if (input?.file?.replace(/\\+/g, '/').indexOf('@nutui') > -1) {
  8. return 375
  9. }
  10. return 750
  11. },
  12. deviceRatio: {
  13. 640: 2.34 / 2,
  14. 750: 1,
  15. 828: 1.81 / 2,
  16. 375: 2 / 1
  17. },
  18. sourceRoot: 'src',
  19. outputRoot: 'dist',
  20. plugins: ['@tarojs/plugin-html', 'tarojs-router-next-plugin'],
  21. defineConstants: {
  22. SERVER_URL: '"https://test.digimeta.com.cn"',
  23. },
  24. copy: {
  25. patterns: [
  26. ],
  27. options: {
  28. }
  29. },
  30. framework: 'vue3',
  31. compiler: {
  32. type: 'webpack5',
  33. prebundle: { enable: false }
  34. },
  35. cache: {
  36. enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
  37. },
  38. mini: {
  39. webpackChain(chain) {
  40. chain.merge({
  41. module: {
  42. rule: {
  43. mjsScript: {
  44. test: /\.mjs$/,
  45. include: [/pinia/],
  46. use: {
  47. babelLoader: {
  48. loader: require.resolve('babel-loader')
  49. }
  50. }
  51. }
  52. }
  53. }
  54. })
  55. chain.plugin('unplugin-vue-components').use(Components({
  56. include: [
  57. /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
  58. /\.vue$/, /\.vue\?vue/, // .vue
  59. ],
  60. resolvers: [NutUIResolver({taro: true})]
  61. }))
  62. },
  63. miniCssExtractPluginOption: {
  64. ignoreOrder: true,
  65. },
  66. postcss: {
  67. pxtransform: {
  68. enable: true,
  69. config: {
  70. // selectorBlackList: ['nut-']
  71. }
  72. },
  73. url: {
  74. enable: true,
  75. config: {
  76. limit: 1024 // 设定转换尺寸上限
  77. }
  78. },
  79. cssModules: {
  80. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  81. config: {
  82. namingPattern: 'module', // 转换模式,取值为 global/module
  83. generateScopedName: '[name]__[local]___[hash:base64:5]'
  84. }
  85. }
  86. }
  87. },
  88. h5: {
  89. webpackChain(chain) {
  90. chain.plugin('unplugin-vue-components').use(Components({
  91. include: [
  92. /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
  93. /\.vue$/, /\.vue\?vue/, // .vue
  94. ],
  95. resolvers: [NutUIResolver({taro: true})]
  96. }))
  97. },
  98. publicPath: '/',
  99. staticDirectory: 'static',
  100. esnextModules: ['nutui-taro', 'icons-vue-taro'],
  101. postcss: {
  102. autoprefixer: {
  103. enable: true,
  104. config: {
  105. }
  106. },
  107. cssModules: {
  108. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  109. config: {
  110. namingPattern: 'module', // 转换模式,取值为 global/module
  111. generateScopedName: '[name]__[local]___[hash:base64:5]'
  112. }
  113. }
  114. }
  115. }
  116. }
  117. module.exports = function (merge) {
  118. if (process.env.NODE_ENV === 'development') {
  119. return merge({}, config, require('./dev'))
  120. }
  121. return merge({}, config, require('./prod'))
  122. }