vue2-client 1.15.1 → 1.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/vue.config.js CHANGED
@@ -1,220 +1,220 @@
1
- const path = require('path')
2
- const webpack = require('webpack')
3
- const ThemeColorReplacer = require('webpack-theme-color-replacer')
4
- const { getThemeColors, modifyVars } = require('./src/utils/themeUtil')
5
- const { resolveCss } = require('./src/utils/theme-color-replacer-extend')
6
- const CompressionWebpackPlugin = require('compression-webpack-plugin')
7
- const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
8
- // const CopyPlugin = require('copy-webpack-plugin')
9
-
10
- const productionGzipExtensions = ['js', 'css']
11
- const isProd = process.env.NODE_ENV === 'production'
12
-
13
- // v4 产品演示
14
- const v3Server = 'http://aote-office.8866.org:31567'
15
- // const gateway = 'http://192.168.50.67:31467'
16
- // const testUpload = 'http://123.60.214.109:8406'
17
- const OSSServerDev = 'http://192.168.50.67:30351'
18
- // const revenue = 'http://aote-office.8866.org:31567'
19
- const revenue = 'http://aote-office.8866.org:31567'
20
- // const OSSServerProd = 'http://192.168.50.67:31351'
21
- // const testUploadLocal = 'http://127.0.0.1:9001'
22
- // v3 铜川
23
- // const v3Server = 'http://61.134.55.234:8405'
24
- // const gateway = 'http://61.134.55.234:8456/webmeter'
25
- // v3 涉县
26
- // const v3Server = 'http://221.193.244.147:9600'
27
- // const gateway = 'http://221.193.244.147:9600/webmeter'
28
- // 本地
29
- // const local = 'http://localhost:8080'
30
-
31
- module.exports = {
32
- devServer: {
33
- // development server port 8000
34
- port: 8020,
35
- // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
36
- proxy: {
37
- // '/apply-image': {
38
- // target: revenue,
39
- // },
40
- '/rs': {
41
- target: v3Server,
42
- ws: false,
43
- changeOrigin: true
44
- },
45
- // '/api/af-system/resource': {
46
- // pathRewrite: { '^/api/af-system': '/' },
47
- // target: testUpload,
48
- // changeOrigin: true
49
- // },
50
- '/api/af-revenue/logic/openapi/': {
51
- // pathRewrite: { '^/api/af-revenue/logic/openapi/': '/logic/' },
52
- target: revenue,
53
- changeOrigin: true
54
- },
55
- '/api/af-scada': {
56
- target: revenue,
57
- changeOrigin: true
58
- },
59
- '/api/af-runtime': {
60
- pathRewrite: { '^/api/af-runtime/': '/' },
61
- target: 'http://127.0.0.1:9001',
62
- // target: revenue,
63
- changeOrigin: true
64
- },
65
- '/api/af-revenue': {
66
- // pathRewrite: { '^/api/af-revenue/': '/' },
67
- target: revenue,
68
- changeOrigin: true
69
- },
70
- '/api/af-liuli': {
71
- // pathRewrite: { '^/api/af-liuli/': '/' },
72
- // target: 'http://127.0.0.1:9014',
73
- target: revenue,
74
- changeOrigin: true
75
- },
76
- '/api/af-gaslink': {
77
- // pathRewrite: { '^/api/af-gaslink/': '/' },
78
- // target: 'http://127.0.0.1:9036',
79
- target: revenue,
80
- changeOrigin: true
81
- },
82
- '/api': {
83
- // v3用
84
- // pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
85
- // pathRewrite: { '^/api/': '/' },
86
- target: revenue,
87
- changeOrigin: true
88
- },
89
- '/devApi': {
90
- // v3用
91
- // pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
92
- // pathRewrite: { '^/api/': '/' },
93
- target: revenue,
94
- changeOrigin: true
95
- },
96
- '/resource': {
97
- // pathRewrite: { '^/resource': '/' },
98
- target: revenue,
99
- changeOrigin: true
100
- },
101
- '/ai': {
102
- target: 'http://192.168.50.67:31761',
103
- pathRewrite: { '^/ai': '/' },
104
- changeOrigin: true
105
- },
106
- '/oss': {
107
- target: OSSServerDev,
108
- pathRewrite: { '^/oss': '/' },
109
- changeOrigin: true
110
- },
111
- },
112
- client: {
113
- overlay: false
114
- }
115
- },
116
- pluginOptions: {
117
- 'style-resources-loader': {
118
- preProcessor: 'less',
119
- patterns: [path.resolve(__dirname, './src/theme/theme.less')]
120
- }
121
- },
122
- configureWebpack: config => {
123
- config.devtool = 'inline-source-map'
124
- // 忽略.md文件
125
- config.module.rules.push(
126
- {
127
- test: /\.md$/,
128
- exclude: /node_modules/,
129
- use: 'ignore-loader'
130
- }
131
- )
132
- config.context = path.resolve(__dirname, './')
133
- config.resolve = {
134
- extensions: ['.js', '.vue', '.json'],
135
- alias: {
136
- '@vue2-client': path.resolve('src'),
137
- '@': path.resolve('src'),
138
- }
139
- }
140
- config.entry.app = ['core-js/stable', 'regenerator-runtime/runtime', 'whatwg-fetch', './src/main.js']
141
- config.performance = {
142
- hints: false
143
- }
144
- if (isProd) {
145
- config.plugins.push(
146
- new ThemeColorReplacer({
147
- fileName: 'css/theme-colors-[contenthash:8].css',
148
- matchColors: getThemeColors(),
149
- injectCss: true,
150
- resolveCss
151
- })
152
- )
153
- }
154
- // Ignore all locale files of moment.js
155
- config.plugins.push(new webpack.IgnorePlugin({
156
- resourceRegExp: /^\.\/locale$/,
157
- contextRegExp: /moment$/
158
- }))
159
-
160
- config.plugins.push(
161
- // new CopyPlugin({
162
- // patterns: [{ from: 'node_modules/amis/sdk', to: 'amis/sdk' }],
163
- // })
164
- )
165
-
166
- // 生产环境下将资源压缩成gzip格式
167
- if (isProd) {
168
- // add `CompressionWebpack` plugin to webpack plugins
169
- config.plugins.push(new CompressionWebpackPlugin({
170
- algorithm: 'gzip',
171
- test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
172
- threshold: 10240,
173
- minRatio: 0.8
174
- }))
175
- }
176
- // if prod, add externals
177
- // if (isProd) {
178
- // config.externals = assetsCDN.externals
179
- // }
180
- },
181
- chainWebpack: config => {
182
- // 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
183
- if (isProd) {
184
- config.optimization.minimizer('css').use(CssMinimizerPlugin, [{
185
- minimizerOptions: {
186
- preset: [
187
- 'default',
188
- {
189
- discardComments: { removeAll: true },
190
- colormin: false,
191
- }
192
- ],
193
- ignoreOrder: true
194
- }
195
- }])
196
- }
197
- config.resolve.alias.set('@vue2-client', path.resolve(__dirname, 'src'))
198
- },
199
- css: {
200
- extract: !isProd
201
- ? {
202
- filename: 'css/[name].css',
203
- chunkFilename: 'css/[name].css',
204
- }
205
- : true,
206
- loaderOptions: {
207
- less: {
208
- lessOptions: {
209
- modifyVars: modifyVars(),
210
- javascriptEnabled: true
211
- }
212
- },
213
- sass: {}
214
- }
215
- },
216
- publicPath: process.env.VUE_APP_PUBLIC_PATH,
217
- outputDir: 'dist',
218
- assetsDir: 'static',
219
- productionSourceMap: false
220
- }
1
+ const path = require('path')
2
+ const webpack = require('webpack')
3
+ const ThemeColorReplacer = require('webpack-theme-color-replacer')
4
+ const { getThemeColors, modifyVars } = require('./src/utils/themeUtil')
5
+ const { resolveCss } = require('./src/utils/theme-color-replacer-extend')
6
+ const CompressionWebpackPlugin = require('compression-webpack-plugin')
7
+ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
8
+ // const CopyPlugin = require('copy-webpack-plugin')
9
+
10
+ const productionGzipExtensions = ['js', 'css']
11
+ const isProd = process.env.NODE_ENV === 'production'
12
+
13
+ // v4 产品演示
14
+ const v3Server = 'http://aote-office.8866.org:31567'
15
+ // const gateway = 'http://192.168.50.67:31467'
16
+ // const testUpload = 'http://123.60.214.109:8406'
17
+ const OSSServerDev = 'http://192.168.50.67:30351'
18
+ // const revenue = 'http://aote-office.8866.org:31567'
19
+ const revenue = 'http://aote-office.8866.org:31567'
20
+ // const OSSServerProd = 'http://192.168.50.67:31351'
21
+ // const testUploadLocal = 'http://127.0.0.1:9001'
22
+ // v3 铜川
23
+ // const v3Server = 'http://61.134.55.234:8405'
24
+ // const gateway = 'http://61.134.55.234:8456/webmeter'
25
+ // v3 涉县
26
+ // const v3Server = 'http://221.193.244.147:9600'
27
+ // const gateway = 'http://221.193.244.147:9600/webmeter'
28
+ // 本地
29
+ // const local = 'http://localhost:8080'
30
+
31
+ module.exports = {
32
+ devServer: {
33
+ // development server port 8000
34
+ port: 8020,
35
+ // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
36
+ proxy: {
37
+ // '/apply-image': {
38
+ // target: revenue,
39
+ // },
40
+ '/rs': {
41
+ target: v3Server,
42
+ ws: false,
43
+ changeOrigin: true
44
+ },
45
+ // '/api/af-system/resource': {
46
+ // pathRewrite: { '^/api/af-system': '/' },
47
+ // target: testUpload,
48
+ // changeOrigin: true
49
+ // },
50
+ '/api/af-revenue/logic/openapi/': {
51
+ // pathRewrite: { '^/api/af-revenue/logic/openapi/': '/logic/' },
52
+ target: revenue,
53
+ changeOrigin: true
54
+ },
55
+ '/api/af-scada': {
56
+ target: revenue,
57
+ changeOrigin: true
58
+ },
59
+ '/api/af-runtime': {
60
+ pathRewrite: { '^/api/af-runtime/': '/' },
61
+ target: 'http://127.0.0.1:9001',
62
+ // target: revenue,
63
+ changeOrigin: true
64
+ },
65
+ '/api/af-revenue': {
66
+ // pathRewrite: { '^/api/af-revenue/': '/' },
67
+ target: revenue,
68
+ changeOrigin: true
69
+ },
70
+ '/api/af-liuli': {
71
+ // pathRewrite: { '^/api/af-liuli/': '/' },
72
+ // target: 'http://127.0.0.1:9014',
73
+ target: revenue,
74
+ changeOrigin: true
75
+ },
76
+ '/api/af-gaslink': {
77
+ // pathRewrite: { '^/api/af-gaslink/': '/' },
78
+ // target: 'http://127.0.0.1:9036',
79
+ target: revenue,
80
+ changeOrigin: true
81
+ },
82
+ '/api': {
83
+ // v3用
84
+ // pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
85
+ // pathRewrite: { '^/api/': '/' },
86
+ target: revenue,
87
+ changeOrigin: true
88
+ },
89
+ '/devApi': {
90
+ // v3用
91
+ // pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
92
+ // pathRewrite: { '^/api/': '/' },
93
+ target: revenue,
94
+ changeOrigin: true
95
+ },
96
+ '/resource': {
97
+ // pathRewrite: { '^/resource': '/' },
98
+ target: revenue,
99
+ changeOrigin: true
100
+ },
101
+ '/ai': {
102
+ target: 'http://192.168.50.67:31761',
103
+ pathRewrite: { '^/ai': '/' },
104
+ changeOrigin: true
105
+ },
106
+ '/oss': {
107
+ target: OSSServerDev,
108
+ pathRewrite: { '^/oss': '/' },
109
+ changeOrigin: true
110
+ },
111
+ },
112
+ client: {
113
+ overlay: false
114
+ }
115
+ },
116
+ pluginOptions: {
117
+ 'style-resources-loader': {
118
+ preProcessor: 'less',
119
+ patterns: [path.resolve(__dirname, './src/theme/theme.less')]
120
+ }
121
+ },
122
+ configureWebpack: config => {
123
+ config.devtool = 'inline-source-map'
124
+ // 忽略.md文件
125
+ config.module.rules.push(
126
+ {
127
+ test: /\.md$/,
128
+ exclude: /node_modules/,
129
+ use: 'ignore-loader'
130
+ }
131
+ )
132
+ config.context = path.resolve(__dirname, './')
133
+ config.resolve = {
134
+ extensions: ['.js', '.vue', '.json'],
135
+ alias: {
136
+ '@vue2-client': path.resolve('src'),
137
+ '@': path.resolve('src'),
138
+ }
139
+ }
140
+ config.entry.app = ['core-js/stable', 'regenerator-runtime/runtime', 'whatwg-fetch', './src/main.js']
141
+ config.performance = {
142
+ hints: false
143
+ }
144
+ if (isProd) {
145
+ config.plugins.push(
146
+ new ThemeColorReplacer({
147
+ fileName: 'css/theme-colors-[contenthash:8].css',
148
+ matchColors: getThemeColors(),
149
+ injectCss: true,
150
+ resolveCss
151
+ })
152
+ )
153
+ }
154
+ // Ignore all locale files of moment.js
155
+ config.plugins.push(new webpack.IgnorePlugin({
156
+ resourceRegExp: /^\.\/locale$/,
157
+ contextRegExp: /moment$/
158
+ }))
159
+
160
+ config.plugins.push(
161
+ // new CopyPlugin({
162
+ // patterns: [{ from: 'node_modules/amis/sdk', to: 'amis/sdk' }],
163
+ // })
164
+ )
165
+
166
+ // 生产环境下将资源压缩成gzip格式
167
+ if (isProd) {
168
+ // add `CompressionWebpack` plugin to webpack plugins
169
+ config.plugins.push(new CompressionWebpackPlugin({
170
+ algorithm: 'gzip',
171
+ test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
172
+ threshold: 10240,
173
+ minRatio: 0.8
174
+ }))
175
+ }
176
+ // if prod, add externals
177
+ // if (isProd) {
178
+ // config.externals = assetsCDN.externals
179
+ // }
180
+ },
181
+ chainWebpack: config => {
182
+ // 生产环境下关闭css压缩的 colormin 项,因为此项优化与主题色替换功能冲突
183
+ if (isProd) {
184
+ config.optimization.minimizer('css').use(CssMinimizerPlugin, [{
185
+ minimizerOptions: {
186
+ preset: [
187
+ 'default',
188
+ {
189
+ discardComments: { removeAll: true },
190
+ colormin: false,
191
+ }
192
+ ],
193
+ ignoreOrder: true
194
+ }
195
+ }])
196
+ }
197
+ config.resolve.alias.set('@vue2-client', path.resolve(__dirname, 'src'))
198
+ },
199
+ css: {
200
+ extract: !isProd
201
+ ? {
202
+ filename: 'css/[name].css',
203
+ chunkFilename: 'css/[name].css',
204
+ }
205
+ : true,
206
+ loaderOptions: {
207
+ less: {
208
+ lessOptions: {
209
+ modifyVars: modifyVars(),
210
+ javascriptEnabled: true
211
+ }
212
+ },
213
+ sass: {}
214
+ }
215
+ },
216
+ publicPath: process.env.VUE_APP_PUBLIC_PATH,
217
+ outputDir: 'dist',
218
+ assetsDir: 'static',
219
+ productionSourceMap: false
220
+ }