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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
| /*
| * @Author: shuishen 1109946754@qq.com
| * @Date: 2022-09-07 09:37:07
| * @LastEditors: shuishen 1109946754@qq.com
| * @LastEditTime: 2023-05-04 20:46:04
| * @FilePath: \web\bigScreen\vue.config.js
| * @Description:
| *
| * Copyright (c) 2022 by shuishen 1109946754@qq.com, All Rights Reserved.
| */
|
| const path = require("path")
| const CopywebpackPlugin = require("copy-webpack-plugin")
| const dvgisDist = "./node_modules/@dvgis"
| const webpack = require("webpack")
|
| const CompressionPlugin = require("compression-webpack-plugin")
| const pxtovw = require("postcss-px-to-viewport")
|
| const productionGzipExtensions = ["js", "css"]
|
| module.exports = {
| //路径前缀
| publicPath: "/bigScreen/",
|
| css: {
| loaderOptions: {
| // 给 sass-loader 传递选项
| scss: {
| prependData: `@import "~@/styles/scssFile.scss";`,
| },
| },
| },
|
| outputDir: 'bigScreen',
|
| // 其他配置
| chainWebpack: (config) => {
| config.plugin("copy").use(CopywebpackPlugin, [
| [
| {
| from: path.join(dvgisDist, "dc-sdk/dist/resources"),
| to: "libs/dc-sdk/resources",
| },
| {
| from: "./public/libs",
| to: "libs",
| },
| {
| from: "./public/depend",
| to: "depend",
| },
| {
| from: "./public/images",
| to: "images",
| },
| {
| from: "./public/check",
| to: "check",
| },
| {
| from: "./public/mapIcons",
| to: "mapIcons",
| }
| ],
| ])
| },
|
| configureWebpack: {
| externals: {
| vue: "Vue",
| Vuex: "Vuex",
| "vue-router": "VueRouter",
| "element-ui": "ELEMENT",
| echarts: "echarts",
| },
| // webpack plugins
| plugins: [
| // Ignore all locale files of moment.js
| new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
|
| // 配置compression-webpack-plugin压缩
| new CompressionPlugin({
| algorithm: "gzip",
| test: new RegExp("\\.(" + productionGzipExtensions.join("|") + ")$"),
| threshold: 10240,
| minRatio: 0.8,
| }),
| new webpack.optimize.LimitChunkCountPlugin({
| maxChunks: 5,
| minChunkSize: 100,
| }),
| ],
| },
|
| devServer: {
| proxy: {
| // 业务平台接口
| "/api": {
| // target用于配置你允许访问数据的计算机名称,即是你的api接口的服务器地址
| target: "http://124.164.10.118:2081",
| // target: "http://192.168.0.102:81",
| // ws: true, //启用webSocket6566
| changeOrigin: true, //开启代理跨域
| pathRewrite: {}//后端接口包含/api前缀,不需要重写
| },
| },
| },
| }
|
|