微信小程序,访客邀约
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

124 line
3.0 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. },
  23. copy: {
  24. patterns: [
  25. ],
  26. options: {
  27. }
  28. },
  29. framework: 'vue3',
  30. compiler: {
  31. type: 'webpack5',
  32. prebundle: { enable: false }
  33. },
  34. cache: {
  35. enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
  36. },
  37. mini: {
  38. webpackChain(chain) {
  39. chain.merge({
  40. module: {
  41. rule: {
  42. mjsScript: {
  43. test: /\.mjs$/,
  44. include: [/pinia/],
  45. use: {
  46. babelLoader: {
  47. loader: require.resolve('babel-loader')
  48. }
  49. }
  50. }
  51. }
  52. }
  53. })
  54. chain.plugin('unplugin-vue-components').use(Components({
  55. include: [
  56. /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
  57. /\.vue$/, /\.vue\?vue/, // .vue
  58. ],
  59. resolvers: [NutUIResolver({taro: true})]
  60. }))
  61. },
  62. miniCssExtractPluginOption: {
  63. ignoreOrder: true,
  64. },
  65. postcss: {
  66. pxtransform: {
  67. enable: true,
  68. config: {
  69. // selectorBlackList: ['nut-']
  70. }
  71. },
  72. url: {
  73. enable: true,
  74. config: {
  75. limit: 1024 // 设定转换尺寸上限
  76. }
  77. },
  78. cssModules: {
  79. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  80. config: {
  81. namingPattern: 'module', // 转换模式,取值为 global/module
  82. generateScopedName: '[name]__[local]___[hash:base64:5]'
  83. }
  84. }
  85. }
  86. },
  87. h5: {
  88. webpackChain(chain) {
  89. chain.plugin('unplugin-vue-components').use(Components({
  90. include: [
  91. /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
  92. /\.vue$/, /\.vue\?vue/, // .vue
  93. ],
  94. resolvers: [NutUIResolver({taro: true})]
  95. }))
  96. },
  97. publicPath: '/',
  98. staticDirectory: 'static',
  99. esnextModules: ['nutui-taro', 'icons-vue-taro'],
  100. postcss: {
  101. autoprefixer: {
  102. enable: true,
  103. config: {
  104. }
  105. },
  106. cssModules: {
  107. enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
  108. config: {
  109. namingPattern: 'module', // 转换模式,取值为 global/module
  110. generateScopedName: '[name]__[local]___[hash:base64:5]'
  111. }
  112. }
  113. }
  114. }
  115. }
  116. module.exports = function (merge) {
  117. if (process.env.NODE_ENV === 'development') {
  118. return merge({}, config, require('./dev'))
  119. }
  120. return merge({}, config, require('./prod'))
  121. }