企微助手 ,仓库名 短剧

vue.config.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. const { defineConfig } = require('@vue/cli-service')
  2. const path = require('path')
  3. const AutoImport = require('unplugin-auto-import/webpack')
  4. const Components = require('unplugin-vue-components/webpack')
  5. const { ElementPlusResolver, VantResolver } = require('unplugin-vue-components/resolvers')
  6. const ElementPlus = require('unplugin-element-plus/webpack')
  7. const CompressionPlugin = require('compression-webpack-plugin')
  8. const Timestamp= new Date().getTime()
  9. function resolve (dir) {
  10. return path.join(__dirname, dir)
  11. }
  12. module.exports = defineConfig({
  13. transpileDependencies: true,
  14. devServer: {
  15. proxy: { // 配置跨域
  16. '/api': {
  17. target: 'http://duanju.wenxingshuju.com',
  18. changeOrigin: true, // 允许跨域
  19. pathRewrite: {
  20. '^/api': '' // 请求的时候使用这个api就可以
  21. }
  22. }
  23. }
  24. },
  25. lintOnSave: false,
  26. publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
  27. outputDir: 'dist',
  28. productionSourceMap: false,//打包不到.map文件
  29. configureWebpack: {
  30. // provide the app's title in webpack's name field, so that
  31. // it can be accessed in index.html to inject the correct title.
  32. resolve: {
  33. alias: {
  34. '@': resolve('src')
  35. }
  36. },
  37. output: { // 输出重构 打包编译后的 文件名称
  38. filename: `js/[name].[hash].${Timestamp}.js`,
  39. chunkFilename: `js/[name].[hash].${Timestamp}.js`
  40. },
  41. plugins: [
  42. AutoImport({
  43. resolvers: [ElementPlusResolver()],
  44. }),
  45. Components({
  46. resolvers: [ElementPlusResolver(), VantResolver()],
  47. }),
  48. ElementPlus(),
  49. new CompressionPlugin({
  50. test: /\.js$|\.html$|\.css/, //匹配文件名
  51. threshold: 10240, //对超过10k的数据进行压缩
  52. deleteOriginalAssets: false //是否删除原文件
  53. }),
  54. ],
  55. },
  56. })