足力健前端,vue版本

uni.config.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const fs = require('fs')
  2. const path = require('path')
  3. const COMPONENTS_DIR_NAME = 'wxcomponents'
  4. function getComponentsCopyOption () {
  5. if (process.env.UNI_OUTPUT_TMP_DIR) { // TODO v3不需要,即将废弃
  6. const componentsDir = path.resolve(process.env.UNI_INPUT_DIR, COMPONENTS_DIR_NAME)
  7. if (fs.existsSync(componentsDir)) {
  8. return {
  9. from: componentsDir,
  10. to: COMPONENTS_DIR_NAME,
  11. ignore: ['**/*.vue', '**/*.css']
  12. }
  13. }
  14. }
  15. }
  16. module.exports = {
  17. options: {
  18. extnames: { // TODO v3不需要此配置
  19. style: '.wxss',
  20. template: '.wxml',
  21. filter: '.wxs'
  22. },
  23. filterTag: 'wxs'
  24. },
  25. copyWebpackOptions (platformOptions, vueOptions) {
  26. const copyOptions = []
  27. const componentsCopyOption = getComponentsCopyOption()
  28. if (componentsCopyOption) {
  29. copyOptions.push(componentsCopyOption)
  30. }
  31. copyOptions.push('hybrid/html')
  32. if (process.env.UNI_USING_V3) { // TODO 将仅保留v3逻辑
  33. copyOptions.push(path.resolve(__dirname, '../dist/view.css'))
  34. copyOptions.push(path.resolve(__dirname, '../dist/view.umd.min.js'))
  35. // TODO 后续common与v3目录应该合并
  36. copyOptions.push(path.resolve(__dirname, process.env.UNI_USING_NVUE_COMPILER ? '../template/common' : '../template/weex'))
  37. copyOptions.push(path.resolve(__dirname, '../template/v3'))
  38. }
  39. return copyOptions
  40. }
  41. }