jinlin
2024-11-03 25e60ce7886f4a809b5495fe3415a2366ad06366
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
/**
 * 配置参考: https://cli.vuejs.org/zh/config/
 */
module.exports = {
  publicPath: process.env.NODE_ENV === 'production' ? './' : './',
  // 配置资源文件打包路径
  assetsDir: './dist',
  transpileDependencies: ['*'],
  chainWebpack: config => {
    const svgRule = config.module.rule('svg')
    svgRule.uses.clear()
    svgRule
      .test(/\.svg$/)
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
 
    // // 处理其他图片文件(例如 PNG、JPEG),去除哈希值
    // config.module.rule('images')
    //   .test(/\.(png|jpe?g|gif)(\?.*)?$/)
    //   .use('file-loader')
    //   .loader('file-loader')
    //   .tap(options => {
    //     // 修改 file-loader 配置,设置 name 为 '[name].[ext]'
    //     return {
    //       ...options,
    //       name: '[name].[ext]'
    //     }
    //   })
  },
  // 默认打开eslint效验,如果需要关闭,设置成false即可
  lintOnSave: false,
  productionSourceMap: false,
  devServer: {
    open: true,
    port: 8031,
    overlay: {
      errors: true,
      warnings: true
    }
  },
  configureWebpack: {
    resolve: {
      alias: {
        vue$: "vue/dist/vue.esm.js"
      }
    }
  }
}