'f'
mh-two-thousand-and-two
2024-04-12 26f2711ef9461961fb953e2b497bd314ef95e345
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const path = require('path')
 
const parseAppJson = require('./parser/app-json-parser')
 
const css = '#seapp-custom-action-sheet{bottom: var(--window-bottom) !important;}'
 
module.exports = {
  configureEnv () {
    process.env.UNI_OUTPUT_DIR = path.join(process.env.UNI_OUTPUT_DIR, 'dist')
  },
  configureH5 (h5Options) {
    h5Options.router.mode = 'hash'
    h5Options.router.base = h5Options.publicPath = '/'
  },
  configurePages (pagesJson, manifestJson, loader) {
    loader.emitFile('app.json', JSON.stringify(parseAppJson(pagesJson, manifestJson), null, 2))
  },
  copyWebpackOptions (platformOptions, vueOptions, copyOptions) {
    if (copyOptions) {
      const copyOption = copyOptions.find(copyOption => copyOption.from.indexOf('index.css') !== -1)
      if (copyOption) {
        copyOption.to = 'app.css'
        copyOption.transform = function (content) {
          return content + css
        }
      }
    }
  },
  configureWebpack (config) {
    return {
      output: {
        filename: (chunkData) => {
          return chunkData.chunk.name === 'index' ? 'app.js' : 'static/js/[name].js'
        }
      },
      resolve: {
        alias: {
          'uni-h5': path.resolve(__dirname, '../dist/index.umd.min.js')
        }
      },
      optimization: {
        splitChunks: {
          cacheGroups: {
            vendors: false,
            common: false
          }
        }
      }
    }
  },
  chainWebpack (config) {
    config.plugins.delete('html-index')
    config.plugins.delete('preload')
    config.plugins.delete('prefetch')
  }
}